# Slope of a Line

How to find the slope of a line and the linear equation y = mx: slope formula, the linear equation y = mx, proof, examples, and their solutions.

## Formula: Slope

The slope means

the ratio of [change of *y*]/[change of *x*].

Ratio

If a line passes through (*x*_{1}, *y*_{1}) and (*x*_{2}, *y*_{2}),

then [change of *x*] = *x*_{2} - *x*_{1}

and [change of *y*] = *y*_{2} - *y*_{1}.

So the slope of the line, *m*, is*m* = (*y*_{2} - *y*_{1})/(*x*_{2} - *x*_{1}).

## Example 1: Positive Slope

The change of *x* is

3 - 1 = 2.

And the change of *y* is

5 - 1 = 4.

Then *m* = 4/2.

As you can see,

if the graph goes upward as *x* increases,

then the slope is (+).

## Example 2: Negative Slope

The change of *x* is

1 - (-4) = 5.

And the change of *y* is

-2 - 1 = -3.

Then *m* = -3/5.

As you can see,

if the graph goes downward as *x* increases,

then the slope is (-).

## Example 3: Zero Slope

The change of *x* is

5 - (-1) = 6.

And the change of *y* is

2 - 2 = 0.

Then *m* = 0/6.

As you can see,

the slope of a horizontal line is 0.

## Example 4: No Slope

The change of *x* is

1 - 1 = 0.

And the change of *y* is

2 - (-3) = 5.

Then *m* = 5/0.

The denominator is 0,

which cannot be defined.

So the given line has [no slope].

As you can see,

a vertical line has no slope.

## Linear Equation: *y* = *mx*

If a line passes through the [origin]

and has a [slope *m*],

then the linear equation is *y* = *mx*.

In other words,*y* = *mx* is a function

that passes through the origin

and that shows the slope *m*.

Function

This is true

unless the line is a vertical line.

(There's no slope: *m* cannot be defined.)

## Proof: *y* = *mx*

Think of a slope

between the origin (0, 0) and (*x*, *y*).

(*x*, *y*) is the point on the line.

The change of *x* is*x* - 0 = *x*.

And the change of *y* is*y* - 0 = *y*.

Then the slope is *y*/*x*.

Then set *y*/*x* = *m*.

Multiply *x* on both sides.

Then *y* = *mx*.

## Example 5

The given line passes through the origin.

And its slope is 3/1.

So the linear equation is *y* = (3/1)*x*

which is *y* = 3*x*.

## Example 6

The given line passes through the origin.

And its slope is -1/2.

So the linear equation is *y* = -1/2*x*.

## Example 7

The given line passes through the origin.

And it's a horizontal line.

So the slope of the line is 0.

So the linear equation is *y* = 0*x*,

which is *y* = 0.

If you see the vertical number line (*y*-axis),

the given horizontal line shows *y* = 0.

You can check the answer like this

when you're wondering

if the answer is *x* = 0 or *y* = 0.

## Example 8

The given line passes through the origin.

And it's a vertical line.

So it has no slope.

Then see the horizontal number line (*x*-axis).

The given vertical line shows *x* = 0.

So *x* = 0 is the answer.