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
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|}$$