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).


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

  • $\begingroup$ Equation for line under Cartesian co-ords: (x-x1) /(y-y1) = (x2-x1)/(y2-y1). Points: (x1,y1) is (1,0), (x2,y2) is (0,-1). Take a walk, get some coffee, do the math again, you'll get it. $\endgroup$ – vben Feb 4 '15 at 20:36

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$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.