﻿ Gradient of a straight line
HOME Mathematics Computer Science Economics
﻿
Introduction
• A gradient describes how much y changes relative to a change in x.
• For example, we can define a line as starting at (0, 0) and ending at (10, 25): • Instead of giving explicit start and end points for the line we can describe it by how much y changes relative to x.
• In the line above, a change of 10 in x produces a change of 25 in y.
• The gradient is defined as the change in y divided by the change in x.
• If we use Δ to denote 'change' then the formula for the gradient (g) of a line is: LaTeX: g = \frac{\Delta y}{\Delta x}
• In the line above, the gradient is: Finding the change in x and y
• In our above example, our first coordinate was (9, 0). This made it easy to calculate how much x and y changed.
• However when both coordinates are non-zero, it gets a bit more complicated.
• For example, calculate the gradient of the line between (1, 2) and (7, 10)
1. To find how much x and y change, we need to subtract the first coordinate from the second
2. 3. • We can use this in our equation to find the gradient of a line: Special Cases
• There are two special cases to look out for when calculating the gradient of a line:
1. When the line is horizontal
• There will be no change in y
2. When the line is vertical
• There will be no change in x
Code
import math