# 8.5: Gradients - How to Find Them

- Page ID
- 3401

The ** gradient** of a variable is just the

*. For instance, the temperature gradient is just the temperature change divided by the distance over which it is changing: ΔT/Δdistance. The gradient is a vector and thus has a direction as well as magnitude.*

*change in that variable as a function of distance*Surface temperature map for North America on 8 September 2012. Temperatures are in ^{o}F. For a point in western Kentucky, the temperature gradient is to the southeast. Credit: Unisys

Consider the surface temperature contour plot from NOAA for 8 September 2012 in the figure above. A strong temperature variation is draped across the eastern and southern US from New York down to Texas. How do we quantify this temperature variation? First we have to specify where we want to measure the temperature gradient. Then we simply need to choose isotherms on either side of the point, take the difference between the isotherms, figure out how far apart they are in horizontal distance, and divide the temperature change between the isotherms by the distance between the isotherms. The direction for the gradient is on the normal (perpendicular to the isotherms) from the lower temperatures to the higher temperatures. It’s pretty easy to figure out where the gradient vector points just by quick examination, but it is a little harder to figure out what the gradient magnitude and actual direction are.

Now watch this video (2:12) on finding distances:

**Finding Distances**

**Click here for transcript of the Finding Distances video.**-
We're often interested in finding distances on a map so that we can calculate quantities we are interested in, such as the temperature gradient. Note first that often the projection of the map that we have does not have east-west, parallel, and straight across. In fact, the east-west line is curved a little bit, so take that into account when you're doing your calculations. Also note the north-south lines run a little bit not parallel as well. So how do we find distances? Well, there are many different ways, but one good way is to take a known distance on the map, scale it with a ruler, and then use that ruler in other places to give us distances in other places. So for instance, we know that the height of Pennsylvania between the two parallel borders, the north and south borders is 135 nautical miles. So we can scale that with a ruler, and I have a ruler here. I put the ruler in, and I see, in this particular case, the distance between the two is just about exactly 1 centimeter or 10 millimeters. So what that means is each millimeter on my scale is equal to 13.5 nautical miles on the map. So then I can use this in other places to measure other distances. So for instance, if I want to know the height of Kansas between its parallel North and South borders, I can put my ruler on there. And if I look carefully, I get a number that's about 13 and 1/2 millimeters. So 13 and 1/2 times 13 and 1/2 is about 182. And that's what I would say this distance is. The actual distance is 180 nautical miles, so in fact, the scaling I have is actually pretty good.

Mathematically, if we know the algebraic expression for the temperature change, such that * T = T*(

*), we can find the gradient by using the*

*x,y***, which is also called the**

**del operator****.**

**gradient operator**Recall the del operator:

\[\vec{\nabla}=\vec{i} \frac{\partial}{\partial x}+\vec{j} \frac{\partial}{\partial y}+\vec{k} \frac{\partial}{\partial z}\]

If we are looking only at changes in * x* and

*, then we can define a horizontal del operator:*

*y*\[\vec{\nabla}_{H}=\vec{i} \frac{\partial}{\partial x}+\vec{j} \frac{\partial}{\partial y}\]

** **At any point, we can determine the gradient of the temperature:

\[\vec{\nabla}_{H} T=\vec{i} \frac{\partial T}{\partial x}+\vec{j} \frac{\partial T}{\partial y}\]

Note that this quantity has dimensions of θ/Lθ/L and a magnitude and a direction. The gradient direction is always normal to the isolines and pointing in the direction of an increase. We can define the normal vector, which is just the unit vector in the direction of the increasing temperature. We will call this normal vector *n*.

Example of a gradient and the math required to calculate the gradient magnitude and direction.

Credit: H.N. Shirer

We can calculate a gradient for every point on the map, but to do this we need to know the change in the temperature over a distance that is centered on our chosen point. One approach is to calculate the gradients in the * x* and

*directions independently and then determine the magnitude by:*

*y*\[\left|\vec{\nabla}_{H} T\right|=\sqrt{\left(\frac{\partial T}{\partial x}\right)^{2}+\left(\frac{\partial T}{\partial y}\right)^{2}}=\left|\frac{\partial T}{\partial n}\right|\]

and the direction by:

\[\mu=\tan ^{-1}\left(\frac{\partial T / \partial y}{\partial T / \partial x}\right)\]

We can program a computer to do these calculations.

However, often we just want to * estimate* the gradient. The gradient can be determined by looking at the contours on either side of the point and computing the change in temperature over the distance. These partial derivatives can be approximated by small finite changes in temperatures and distances, so that ∂ is replaced by Δ in all places in these equations. We can calculate gradients by using “centered differences” as shown in the figures below.

Calculating the temperature gradient in the * x* (top) and

*(bottom) directions using the centered difference method. Credit: H.N. Shirer*

*y*We then calculate the magnitude with Equation [8.12] and the direction with Equation [8.13], where we replace the partial derivatives with the small finite differences in all places in these equations.

Example of an estimation of the gradients in the * x* and

*directions. To get an idea of the horizontal scale, you can estimate distances using the known size of a state or country, in this case, Pennsylvania, which is on average 470 km (254 nm, nautical miles, 290 miles) in the*

*y**(east–west) direction and 250 km (135 nm, 155 miles) in the*

*x**(north–south) direction for the parts where the north and south borders are parallel lines. Credit: H.N. Shirer*

*y*The magnitude and direction are:

\[\left|\nabla_{H} T\right|=\sqrt{\left(\frac{\Delta T}{\Delta x}\right)^{2}+\left(\frac{\Delta T}{\Delta y}\right)^{2}}=\sqrt{\left(\frac{4^{\circ} \mathrm{F}}{45 \mathrm{nm}}\right)^{2}+\left(\frac{-4^{\circ} \mathrm{F}}{84 \mathrm{nm}}\right)^{2}}=0.1^{\circ} \mathrm{F} / \mathrm{nm}\]

\(\mu=\tan ^{-1}\left(\frac{\Delta T / \Delta y}{\Delta T_{/ \Delta x}}\right)=\tan ^{-1}\left(\frac{-4 / 84}{4 / 45}\right)=-28^{\circ},\) which points to the southeast

When you calculate the arctangent, keep in mind that the tangent function has the same values every 180^{o}, or every π in radians. If you get an answer for the arctangent that is 45^{o}, how do you know whether the angle is really 45^{o} or 45^{o}+ 180^{o} = 225^{o}? The gradient vector always points toward the higher temperature air, so always choose the angle so that the gradient vector points toward the warmer air.

Recap of the process for calculating the temperature gradient:

- Determine the distance scale by any means that you can. Sometimes it is given to you; sometimes you can scale off a ruler; sometimes you just estimate it using the size of known boundaries.
- Determine the spacing between the isotherms.
- Find the temperature change in the
and*x*directions using the centered difference method. These two numbers, ΔT/Δx and ΔT/ΔyΔT/Δx and ΔT/Δy ΔT/Δx and ΔT/ΔyΔT/Δx and ΔT/Δy can be either positive or negative.*y* - Calculate the magnitude by finding the square root of the squares of the gradients in the
and*x*directions (i.e., ΔT/Δx and ΔT/ΔyΔT/Δx and ΔT/Δy*y* - Calculate the direction of the gradient vector by finding the arctangent of the
-gradient divided by the*y*-gradient. Pay attention to the direction—make sure that it points toward the warmer air.*x*

Now watch this video (3:52) on finding gradients:

**Finding Gradients**

**Click here for transcript of the Finding Gradients video.**-
We can calculate the gradient by using the method that's described in the lesson. Let's pick a point in Pennsylvania about here, and then we'll calculate the gradient for that point. We will first look at the gradient in the x direction which goes along, and it's parallel with the North and South boundaries of Pennsylvania. We'll use the method of center differences that's described. We'll look at this contour here, this isotherm, and this one over here on the other side. And we note that this distance here is very, very similar to the distance of Pennsylvania between the parallel borders, which is 135 nautical miles. And so each one of these contours is four degrees Fahrenheit. So we have two of them, so 8 divided by 135 nautical miles gives us a gradient in the x direction of 0.059 degrees Fahrenheit per nautical miles. Now we can do the y direction, so we pick two points here. One here and one about here to be on the gradients. And we note that this is a little bit more than half the height of Pennsylvania. It's actually about 80 nautical miles. But also note that as y goes more positive, the temperature becomes more negative and therefore, we have to use minus 8 over 80. And we get, for the gradient in the y direction, minus 0.1 degrees Fahrenheit per nautical miles. When we put these in to get the magnitude-- it's the square root of the squares-- we see that we end up with 0.12 degrees Fahrenheit per nautical mile with a magnitude of the gradient. To find the direction of the gradient we see that mu, the angle with respect to the x-axis-- so this is a math angle. It's equal to the arctangent of the gradient in y divided by the gradient in x. And so that would be the arctangent of minus 0.1 over 0.059, which is minus 59 degrees. And that is, of course, measured from the x-axis here. So that is measured from this direction here like this, and so that's minus 59. And it's the same as if we went all the way around and we would get 301 for alpha if we were looking at the math angle. Now, we can look and get an idea about gradients and other places really quickly, so let's just take this point in Central Oregon. So now x is going like this over here, and so we see that the gradient in the East West direction, or x direction is-- to go to another country you have to go very, very far, and so that would be 8 degrees. It's so far the really the gradient is essentially 0. Whereas if we go in the North South direction-- that is in the y direction here-- we see that there's quite a substantial distance here. And so, since this is 8 degrees, just like this is 8 degrees over here, then what that means is the gradient is going to be quite a bit smaller in this direction than it is in Pennsylvania here where the isotherms are much, much closer together. So we would expect a gradient that's a fourth or a fifth of the gradient that we got for Pennsylvania, and so it'll be very weak. Nonetheless, it'll point toward the hotter air, and it'll look something like this.

A word about finding gradients in the real world. Sometimes the centered differences method is difficult to apply because the gradient is too much east–west or north–south. For instance, in the temperature map at the beginning of this section, the * x*-gradient is hard to determine by the centered difference method in the Oklahoma panhandle and the

*-gradient is hard to determine in central Pennsylvania because in both cases, the temperature hardly changes. In these cases, you could say that the gradient in that direction equals 0, but then your computer program might have a hard time finding the arctangent. One way around this problem is to put in a very small number for the gradient in that direction, say 1 millionth of your typical gradient numbers, to do the calculation.*

*y*A second word about finding gradients in the real world. When you are finding temperature gradients from a temperature map, it is sometimes hard to determine the temperature gradient at some locations because the isotherms are not evenly spaced and can be curvy. Don't despair! Use your best judgment as to what the gradients are. Check your answers for the magnitude and direction of the temperature gradient vector by estimating the magnitude and direction by eyeballing the normal to the isotherms at that location and pointing the gradient vector to the warmer air. If your calculated direction is 160 degrees when your eyeball check says about 220 degrees, check your math again.