Android app on Google Play

Lines and points

The equation of a straight line is given by:

y=a*x+b

where a is the slope of the line. If a = 0, the line is horizontal. b indicate the intersection of the line with the y-axis.

Finding the equation of a line, when two points are given

The equation of a straight line, two points are given

It’s possible to find the equation of a straight line, when two of its points are given:

(x1,y1) and (x2, y2).

First you have to determine a and b of the equation of a straight line:

a=frac{y_2-y_1}{x_2-x_1}

b=y_1-a*x_1

a and b can then be substituted into the equation of a straight line.

y=a*x+b

The equation of a straight line when two points are given

Point 1
x1: y1:
Point 2
x2: y2:

Finding the equation of a line, when a point and the line’s slope is given

The equation of a straight line passing through the point (x0, y0) and with the slope a is given by:

y-y_0=a*(x-x_0)

If the angle θ between the x-axis and the line is given instead of the slope a, it’s possible to calculate a in the following way:

a=tan(theta)