# Line Calculator

This calculator will find the equation of a line (in the slope-intercept, point-slope and general forms) given two points or the slope and one point, with steps shown.

## Solution

**Your input: find the equation of a line given two points $$$P=\left(-4, 7\right)$$$ and $$$Q=\left(1, 2\right)$$$.**

The slope of a line passing through the two points `P=(x_1, y_1)` and `Q=(x_2, y_2)` is given by `m=(y_2-y_1)/(x_2-x_1)`.

We have that $$$x_1=-4$$$, $$$y_1=7$$$, $$$x_2=1$$$, $$$y_2=2$$$.

Plug the given values into the formula for slope: $$$m=\frac{\left(2\right)-\left(7\right)}{\left(1\right)-\left(-4\right)}=\frac{-5}{5}=-1$$$.

Now, the y-intercept is `b=y_1-m*x_1` (or `b=y_2-m*x_2`, the result is the same).

$$$b=7-\left(-1\right) \cdot \left(-4\right)=3$$$.

Finally, the equation of the line can be written in the form `y=mx+b`.

$$$y=-x+3$$$.

**Answer:**

**The slope of the line is** $$$m=-1$$$.

**The equation of the line in the slope-intercept form is** $$$y=-x+3$$$.

**The equation of the line in the point-slope form is** $$$y - 7 = - (x + 4)$$$.

**The equation of the line in the point-slope form is** $$$y - 2 = - (x - 1)$$$.

**The general equation of the line is** $$$x + y - 3 = 0$$$.