I have the following task:
Let $(x_1, y_1)$ and $(x_2, y_2)$ be two points in the plane. We want to determine a
straight line given by the function $f$, i.e. $f(x) = mx + n$, such that $f(x_k) = y_k$
($k = 1,2$).
Find $m$ and $n$.
I solved it like this:
$$ m = \frac{y_2-y_1}{x_2-x_1} $$
and
$$ n = y_1-{mx_1} = y_1- \frac{y_2-y_1}{x_2-x_1}\cdot x_1 $$
Did I calculate it correctly?
Best Answer
We get $$m=\frac{y_2-y_1}{x_2-x_1}$$ so $$n=y_1-\left(\frac{y_2-y_1}{x_2-x_1}\right)x_1$$ so $$n=\frac{x_2y_1-x_1y_2}{x_2-x_1}$$