# How to do linear interpolation?

Here in my book they have shown interpolation using parametric equation of line but I am unable to figure out how do they found out t=|y1-ys|/y1-y2 , t=|AD|/|AB| , t=|CE|/CB ,t=|EP|/|DE| here is the pic

• I prefer to think that linear interpolation is a weighted average with linked weights so that $p_i = t p_1 + (1 - t) p_2$ because this is easier in vector form and also motivated by vector drawings. Obviously its the same thing but expressed differently. Jan 15, 2021 at 22:24

Since this is linear interpolation it boils down to solving a linear equation

$$y = a + b t$$

You can substitute the following $$y = y_s$$, $$a = y_1$$(intercept) and $$b = y_2 - y_1$$ (slope) to get the following

$$y_s = y_1 + t(y_2 - y_1)$$ $$y_s - y_1 = t(y_2 - y_1)$$ $$\frac{y_s - y_1}{y_2 - y_1} = t$$

The same thing happens for points where you can write

$$D = A + (B-A)t$$

$$(D-A) = (B-A)\cdot t$$ $$(D-A)^2 = ((B-A)\cdot t)^2$$ $$\sqrt{(D-A)^2} = \sqrt{((B-A)\cdot t)^2}$$ $$\sqrt{(D-A)^2} = \sqrt{(B-A)^2 \cdot t^2}$$ $$\sqrt{(D-A)^2} = \sqrt{(B-A)^2} \cdot\sqrt{ t^2}$$ $$|D-A| = |B-A| \cdot t$$ $$t = \frac{|D-A|}{|B-A|}$$

• But how could the slope be y2- y1 slope is : change in y over change in x i.e ∆y/∆x Jan 13, 2021 at 13:47
• actually the slope in this case is ∆y/∆t Jan 14, 2021 at 11:13

I4=I1 ( 1-t ) + t.I2 ; from parametric equation of line

I4=I1 - I1.t + t. I2

I4=I1+ t (I2-I1) Let's take line AB apart from triangle

below in the equation I multiply t2 to numerator an denominator