Welcome to the gradient calculator, where you'll have the opportunity to learn how to calculate the gradient of a line going through two points. "What is gradient?" you may ask. Well, have you ever looked at a mountain and said to yourself, "Wow, that mountain is quite steep, but not as steep as the one next to it!"? And if that kind of question has left you wondering how their steepness compares, you've come to the right place!

What is gradient?

Before we take a look at the gradient definition, let's get back to our mountain scene, and the absolutely crucial question of steepness.

Let's say you're skiing down a slope when The Big Question hits you. You stop and think about it before going any further. As we've mentioned above, all you need is two points to find the gradient, so why not be a little self-centered and choose yourself as the... well, center, that is, the point (x₁,y₁) = (0,0) on the plane.

Now we're left with finding a second point, (x₂,y₂), up or down the slope. You look around you to find some particularly bushy tree or a pretty young skier. Or an old smelly one for that matter, I'm not judging.

Tell the tree or the skier to stand still while you use your handy ruler (that you always carry around with you, of course) to count how much higher/lower they are from you (that will be y₂) and how far they are from you (that will be x₂). Remember to count the distance between you two horizontally, not parallel to the slope. And there you have it! The ratio of y₂ / x₂ is your gradient, or the steepness of the mountain at that point.

For sticking around while you perform your quick experiment, go and buy that skier some hot chocolate, or give the tree a hug. They deserve as much.

Gradient definition

An informal definition of the gradient (also known as the slope) is as follows: it is a mathematical way of measuring how fast a line rises or falls. Think of it as a number you assign to a hill, a road, a path, etc., that tells you how much effort you have to put to cycle it. If you're going uphill, you must struggle to reach the peak, so the energy needed (i.e., the gradient) is large. If you're going downhill, you don't even have to pedal to pick up speed, so the effort is, in fact, negative. And if you're on flat ground, it neither helps nor makes it harder, so it is neutral, or has a gradient of zero.

And what if you're facing a vertical slope? Well, it's not always clear if you want to fall down it (which is effortless) or go scrambling up it. Therefore, in this case the gradient is undefined.

How to calculate gradient?

To calculate the gradient, we will find two points. We will denote these points with the cartesian coordinates (x₁,y₁) and (x₂,y₂) respectively. This is also the notation used in the calculator. Note that we used the same symbols in the real-life example. We want to see how they relate to each other, that is, what is the rise over run ratio between them. It is described by the gradient formula:

gradient = rise / run

with rise = y₂ - y₁ and run = x₂ - x₁. The rise is how much higher/lower the second point is from the first, and the run is how far (horizontally) they are from each other.

Gradient formula: example of application

Now that we know the gradient definition, it's time to see the gradient calculator in action and go through how to use it together, step by step:

  1. Find two arbitrary points on the line you want to study and find their cartesian coordinates. Let's say we want to calculate the gradient of a line going through points (-2,1) and (3,11).
  2. Take the first point's coordinates and put them in the calculator as x₁ and y₁.
  3. Do the same with the second point, this time as x₂ and y₂.
  4. The calculator will automatically use the gradient formula and count it to be (11 - 1) / (3 - (-2)) = 2.
  5. Enjoy the knowledge of how steep the slope of your line is and go tell all your friends about it!

Common misconceptions and mistakes

You may ask yourself, "Hold on, I think I've seen this somewhere else. Doesn't something similar happen when you count the slope, or the rise over run?" You're absolutely right. All three of these concepts: gradient, slope, and rise over run describe the same thing, and don't you worry, there is no difference between them.

You may also wonder how steep is steep; that is, what does the 2 in the above example tell us. Is it a lot, or is it not? Is the pretty skier going to be impressed by this number? Well, it's all a matter of perspective, and some may say one thing, while others will say the opposite. As a point of reference, you should remember that having a line parallel to the horizon is considered neutral here, as the gradient equals zero. When it rises (or falls), it becomes more and more like a line perpendicular to the horizon, where the slope goes to infinity when it rises (or minus infinity when it is falling).

Maciej Kowalski, PhD candidate