How to find equation for a line on a graph

1.2k Views Asked by At

I'm working on something that says the following:

enter image description here

Source: http://www.inf.unibz.it/~zini/ML/slides/ml_2012_lab_05_solutions.pdf (solution 2)

I can't wrap my head around how they get that equation from that graph??

If the equation is:

X1 - X1A         X2 - X2A
---------    =  ----------
X1B - X1A        X2B - X2A

then for their answer to work the points would have to be:

    (x1, x2)
A = (0 , -1)
B - (1 ,  0)

which isn't true since the line crosses A axis at 1 and B axis at -1 (like they say).

Question

How are they deriving that line equation from that given graph?

1

There are 1 best solutions below

0
On

To find the equation of a line you need its gradient $m$ and its $y$ intercept.

The gradient $m=\frac{y_2-y_1}{x_2-x_2}$ this can be found because you know the points $(1,0)$ and $(0,-1)$ substituting in gives $m=\frac{0--1}{1-0}=1$

The $ y$ intercept is $-1$.

The equation of a line is $y=mx+c$ so you have $y=1x+(-1)$.

In your variables $B=A-1$ so $A=B+1$