Chapter 23. Change of variables

We’ll do just two variables for now; the 3D situation is exactly the same and we cover it later.

§23.1 [TEXT] Interval notation

One quick notational thing if you haven’t seen this before:

Definition: Interval notation
Suppose [𝑎,𝑏] and [𝑐,𝑑] are closed intervals in ℝ (so 𝑎≤𝑏 and 𝑐≤𝑑). By [𝑎,𝑏]×[𝑐,𝑑] we mean the rectangle consisting of points (𝑥,𝑦) such that 𝑎≤𝑥≤𝑏 and 𝑐≤𝑦≤𝑑. (So the four corners of the rectangle are (𝑎,𝑐), (𝑎,𝑑), (𝑏,𝑐), (𝑏,𝑑).)
Example
For example [0,1]×[0,1] would be a unit square whose southwest corner is at the origin. Similarly, [0,5]×[0,3] would be a rectangle of width 5 and height 3.

Figure 48: A picture of [0,5]×[0,3]. This is just the set of points where 𝑥 is in the interval [0,5] and 𝑦 is in the closed interval [0,3].

§23.2 [TEXT] Transition maps

As it turns out 𝑥𝑦-integration (or 𝑥𝑦𝑧-integration in 3D) isn’t always going to be nice, even if you try both horizontal and vertical slicing.

The standard example that’s given looks something like this: suppose you want to integrate the region bounded by the four lines

𝑥𝑦=169,𝑥𝑦=1625,𝑥=4𝑦,𝑦=4𝑥.

This region is sketched in Figure 49. As I promised you, I think it’s better for your thinking if you write these as inequalities:

1625≤𝑥𝑦≤16914≤𝑦𝑥≤4.

(11)

Figure 49: A cursed region bounded by four curves. Trying to do 𝑥𝑦-integration in either direction will be annoying as heck.

This chapter introduces a technique called “change of variables” that will allow us to handle annoying-looking regions like Equation 11, where we don’t want to do 𝑥𝑦-integration. The idea is to make a new map of the yellow region with a different coordinate system. To do this, I need to tell you a new term:

Definition of transition map

Suppose ℛ︀ is a region. Let ℛ︀new be another region, often a rectangle. A transition map for ℛ︀ is a function 𝐓:ℛ︀new→ℛ︀ that transforms ℛ︀new to ℛ︀.

In 18.02 we always require that all the points except possibly the boundaries of ℛ︀new get mapped to different points in ℛ︀. Thus, writing the inverse 𝐓−1 usually also makes sense.

If ℛ︀new is a rectangle — and again, that’s quite common — then sometimes 𝐓 is also called a cell (e.g. my Napkin does this when discussing differential forms).

Remark: An analogy to the world map

Cartography or geography enthusiasts will find that the word “map” gives them the right instincts. If you print a world map on an 8.5×11 or A4 sheet of paper, it gives you a coordinate system for the world with longitude and latitude. So ℛ︀ can be thought of as the surface of the Earth, while ℛ︀new is the rectangular sheet of paper. (I’m lying a little bit because the Earth lives in 3D space but not 2D space, but bear with me.)

The map is always distorted in some places, because the Earth is bent: the north and south pole will often get stretched a ton, for example. But that’s okay — as long as each longitude and latitude gives you a different point on Earth, we’re satisfied. Technically there are exceptions at the north and south poles, but those are on the boundary and we let it slide.

This corresponds to the idea that a cell can capture a complicated area with two coordinates. See Figure 50.

Figure 50: One of the map projections from XKCD 977, a chart titled What your favorite map projection says about you. There’s several more if you’re curious.

Now how does a transition map help us? Well, first, let’s show how we can do cartography on the region we just saw, and then worry about the integration later.

The key idea is that we need to rig our transition function such that

𝑢=𝑦𝑥,𝑣=𝑥𝑦

so that our two inequalities we saw earlier are just

14≤𝑢≤4,1625≤𝑣≤169.

This lets us make a portrayal of the yellow region as a sheet of paper. See Figure 51, which is really important to us!

Figure 51: We use a rectangle with (𝑢,𝑣) as our new region ℛ︀new. The transition map lets us do cartography on the region ℛ︀.

How do we actually express the transition map of 𝐓? It’s actually easier to write the inverse; in this context it’s actually more natural to write

𝐓−1(𝑥,𝑦)=(𝑦𝑥,𝑥𝑦).

If you really need 𝐓 itself, you would solve for 𝑢 and 𝑣 in terms of 𝑥 and 𝑦 to get

𝑥=𝑣𝑢𝑦=𝑢𝑣

so that our transition map is given exactly by

𝐓(𝑢,𝑣)=(𝑣𝑢,𝑢𝑣).

However, actually for integration purposes (we’ll see this next section) you can actually get away with only the formula for 𝐓−1 instead.

§23.3 [TEXT] Integration once you have a transition map

If you remember change-of-variables from 18.01, the 18.02 is the grown-up version where you have a transition map instead.

Definition: Jacobian determinant
Let 𝐓 be a transition map defined from a region in ℝ𝑛 to ℝ𝑛. The Jacobian matrix is the matrix whose rows are the gradients of each component written as row vectors; the Jacobian determinant is its determinant. In these notes we denote the matrix by 𝐽𝐓 (and the determinant by det𝐽𝐓).

For example in a 2×2 case, if the transition map 𝐓(𝑢,𝑣) is written as 𝐓(𝑢,𝑣)=(𝑝(𝑢,𝑣),𝑞(𝑢,𝑣)), then

𝐽𝐓=(𝜕𝑝𝜕𝑢𝜕𝑝𝜕𝑣𝜕𝑞𝜕𝑢𝜕𝑞𝜕𝑣).
Example

Let’s consider the transition map 𝐓(𝑢,𝑣) we saw earlier, that is

𝐓(𝑢,𝑣)=(𝑣𝑢,𝑢𝑣).

We compute the gradient of (𝑢,𝑣)↦𝑣𝑢 by taking the two partials:

𝜕𝜕𝑢𝑣𝑢=−12𝑢−32𝑣12𝜕𝜕𝑣𝑣𝑢=12𝑢−12𝑣−12.

The other component (𝑢,𝑣)↦𝑢𝑣 has the following gradient:

𝜕𝜕𝑢𝑢𝑣=12𝑢−12𝑣12𝜕𝜕𝑣𝑢𝑣=12𝑢12𝑣−12.

So the Jacobian matrix for 𝐓 is

𝐽𝐓=(−12𝑢−32𝑣1212𝑢−12𝑣−1212𝑢−12𝑣1212𝑢12𝑣−12).
Example

We can also find the Jacobian matrix of the inverse map too, that is, the transition map 𝐓−1:ℛ︀→ℛ︀new defined by

𝐓−1(𝑥,𝑦)=(𝑦𝑥,𝑥𝑦).

In other words, this is the map that transforms (𝑥,𝑦) into (𝑢,𝑣). This is actually less painful because you don’t have to deal with the square roots everywhere.

𝜕𝜕𝑥(𝑦𝑥)=−𝑦𝑥2,𝜕𝜕𝑦(𝑦𝑥)=1𝑥𝜕𝜕𝑥(𝑥𝑦)=𝑦,𝜕𝜕𝑦(𝑥𝑦)=𝑥.

So the Jacobian matrix for 𝐓−1 is

𝐽𝐓−1=(−𝑦𝑥21𝑥𝑦𝑥).

Okay, now for the result. We’ll postpone giving a justification for this theorem until Section 24.6, since I want to have done a few concrete examples before drawing the right picture.

Memorize: Change of variables

Suppose you need to integrate ∬ℛ︀𝑓(𝑥,𝑦)d𝑥d𝑦 and you have a transition map 𝐓(𝑢,𝑣):ℛ︀new→ℛ︀. Then the transition map lets you change the integral as follows:

∬ℛ︀𝑓(𝑥,𝑦)d𝑥d𝑦=∬ℛ︀new𝑓(𝑥,𝑦)|det𝐽𝐓|d𝑢d𝑣

Alternatively, if it’s easier to compute 𝐽𝐓−1, the following formula also works:

∬ℛ︀𝑓(𝑥,𝑦)d𝑥d𝑦=∬ℛ︀new𝑓(𝑥,𝑦)|det𝐽𝐓−1|d𝑢d𝑣

However, in the latter case your Jacobian determinant will have 𝑥 and 𝑦 in it that you need to translate back into 𝑢 and 𝑣.

Here |det𝐽𝐓| is called the area scaling factor: it’s the absolute value of the determinant of the Jacobian matrix. It’s indeed true that

det𝐽𝐓−1=1det(𝐽𝐓)

which means that if your transition map has a nicer inverse than the original, you might prefer to use that instead.

Type signature
The area scaling factor is always a nonnegative real number.
Tip

You might find it easier to remember both formulas if you write

d𝑢d𝑣=|det𝐽𝐓−1|d𝑥d𝑦

so it looks more like d𝑢=𝜕𝑢𝜕𝑥d𝑥 from 18.01. (Indeed the 18.01 formula is the special case of a 1×1 matrix!)

Digression on what d𝑢d𝑣 means
For 18.02, the equation d𝑢d𝑣=|det𝐽𝐓−1|d𝑥d𝑦 is more of a mnemonic right now than an actual equation; that’s because in 18.02 we don’t give a definition of what d𝑥 or d𝑦 mean. It can be made into a precise statement using something called a differential form. This is out of scope for 18.02, which has the unfortunate consequence that I can’t give a formal explanation why the change-of-variable formula works. That said, see Section 24.6 later for an informal explanation.

This is the analog in 18.01 when you did change of variables from 𝑥 to 𝑢 (called 𝑢-substitution sometimes), and you changed d𝑥 to d𝑥d𝑢d𝑢. In 18.02, the derivative from 18.01 is replaced by the enormous Jacobian determinant.

Let’s see an example of how to carry out this integration.

Sample Question

Compute the area of the region ℛ︀ in the first quadrant bounded by the curves

𝑥𝑦=169,𝑥𝑦=1625,𝑥=4𝑦,𝑦=4𝑥.

Solution. In the previous sections we introduced variables 𝑢=𝑦𝑥 and 𝑣=𝑥𝑦, and considered the region

ℛ︀new=[14,4]×[1625,169]

which were the pairs of points (𝑢,𝑣) in that rectangle we described earlier. We made a transition map 𝐓:ℛ︀new→ℛ︀ written as either

𝐓(𝑢,𝑣)=(𝑣𝑢,𝑢𝑣)𝐓−1(𝑥,𝑦)=(𝑦𝑥,𝑥𝑦).

We don’t like square roots, so we’ll use the determinant of the Jacobian matrix for 𝐓−1, which is

det(𝐽𝐓−1)=|−𝑦𝑥21𝑥𝑦𝑥|=(−𝑦𝑥2)⋅𝑥−1𝑥⋅𝑦=−𝑦𝑥−𝑦𝑥=−2𝑦𝑥.

Since we used the upside-down version of the formula, we need to translate this back into 𝑢 and 𝑣 through the given formula. In this case since 𝑢=𝑦𝑥, you can do it just by looking:

det(𝐽𝐓−1)=−2𝑢.Area(ℛ︀)=∫𝑢=144∫𝑣=16251691|det(𝐽𝐓−1)|d𝑣d𝑢=∫𝑢=144∫𝑣=162516912𝑢d𝑣d𝑢=∫𝑢=14412𝑢⋅(169−1625)d𝑢=128225∫𝑢=1441𝑢d𝑢=128225(log4−log(14))=512log2225.

□

§23.4 [TEXT] Another example: the area of a unit disk

Sample Question
Show that the area of the unit disk 𝑥2+𝑦2≤1 is 𝜋.

Solution. For reasons that will soon be obvious, we use the letters 𝑟 and 𝜃 rather than 𝑢 and 𝑣 for this problem. This time our cartographer’s transition map is going to be given by

𝐓:[0,1]×[0,2𝜋]→ℝ2𝐓(𝑟,𝜃)≔(𝑟cos𝜃,𝑟sin𝜃).

You might recognize this as polar coordinates. This gives us a way to plot the unit disk as a rectangular map; see the figure.

Figure 52: The map 𝐓:[0,1]×[0,2𝜋]→ℝ2 whose image is the unit disk.

(Careful students might notice that the points on the line segment from (0,0) to (1,0) are repeated more than once under the transition map; again, in 18.02 we allow this repetition on the boundary.)

We calculate the Jacobian of 𝐓:

𝐽𝐓=(𝜕𝜕𝑟(𝑟cos𝜃)𝜕𝜕𝜃(𝑟cos𝜃)𝜕𝜕𝑟(𝑟sin𝜃)𝜕𝜕𝜃(𝑟sin𝜃))=(cos𝜃−𝑟sin𝜃sin𝜃𝑟cos𝜃).

The area scaling factor is then

|det𝐽𝐓|=|cos𝜃−𝑟sin𝜃sin𝜃𝑟cos𝜃|=𝑟cos2𝜃−(−𝑟sin2𝜃)=𝑟(cos2𝜃+sin2𝜃)=𝑟.

Hence, the transition map gives us the following change of variables:

∬𝑥2+𝑦2=11d𝑥d𝑦=∫𝑟=01∫𝜃=02𝜋𝑟d𝜃d𝑟.

This is easy to integrate:

∫𝑟=01(∫𝜃=02𝜋𝑟d𝜃)d𝑟=∫𝑟=01(2𝜋𝑟)d𝑟=2𝜋∫𝑟=01(𝑟)d𝑟=2𝜋[𝑟22]𝑟=0𝑟=1=𝜋.

□

Tip: remembering forwards vs backwards
If you have trouble remembering which way is “forwards” (meaning you use |det𝐽|) versus which way is “backwards” (meaning you use 1|det𝐽|), it might help to look at Table 12 to see these side by side. Just remember: the polar one is forwards, so we get d𝑥d𝑦=𝑟d𝑟d𝜃.
ExampleForwardsBackwards
Example setup𝑥=𝑟cos𝜃𝑦=𝑟sin𝜃𝑢=𝑦/𝑥𝑣=𝑥𝑦
Example Jacobian matrix(cos𝜃−𝑟sin𝜃sin𝜃𝑟cos𝜃)(−𝑦/𝑥21/𝑥𝑦𝑥)
Example Jacobian determinant𝑟−2𝑦/𝑥=−2𝑢
Example change of variablesd𝑥d𝑦=𝑟d𝑟d𝜃d𝑢d𝑣=2𝑢d𝑥d𝑦d𝑥d𝑦=12𝑢d𝑢d𝑣
Table 12: Side-by-side comparison of forwards and backwards changes of variables for the two examples we just did.

§23.5 [TEXT] Example: the area of an ellipse

Once we know the area of a circle, we can also compute the area of an ellipse by reducing to the area of a circle, as follows.

Sample Question

Let 𝑎,𝑏>0 be positive real numbers Compute that the area inside the ellipse

𝑥2𝑎2+𝑦2𝑏2=1.

Solution. Let ℛ︀ be the interior of the ellipse. Consider the transformation 𝐓 defined by

𝑥=𝑎𝑢𝑦=𝑏𝑣.

That is, 𝐓(𝑢,𝑣)=(𝑎𝑢,𝑏𝑣). The Jacobian of this matrix is easy to calculate:

𝐽𝐓=(𝜕𝜕𝑢(𝑎𝑢)𝜕𝜕𝑣(𝑎𝑢)𝜕𝜕𝑢(𝑏𝑣)𝜕𝜕𝑣(𝑏𝑣))=(𝑎00𝑏)

which has determinant 𝑎𝑏.

This transformation provides a mapping between the regions

𝐓:{𝑢2+𝑣2≤1}→ℛ︀={𝑥2𝑎2+𝑦2𝑏2≤1}.

Hence, via change of variables the area of ℛ︀ is related by

Area(ℛ︀)=∬ℛ︀1d𝑥d𝑦=∬𝑢2+𝑣2≤1det𝐽𝐓d𝑢d𝑣=𝑎𝑏∬𝑢2+𝑣2≤1d𝑢d𝑣.=𝑎𝑏Area({𝑢2+𝑣2≤1})=𝑎𝑏𝜋.

□

To put this example into a picture, the idea is that we use a change of variables to map the ellipse into a circle, where the Jacobian determinant is the constant function 𝑎𝑏. That determinant factors out, and we get the result above.

§23.6 [SIDENOTE] Tip: Factoring integrals over rectangles

Especially with polar coordinates, you will often find you get an integral of the shape

∫𝑢=numbernumber∫𝑣=numbernumber𝑓(𝑢)𝑔(𝑣)d𝑣d𝑢

that is, the part inside splits cleanly as the product of stuff involving 𝑢 and stuff involving 𝑣. In that case, if you imagine actually doing the integration, you’ll find that this actually just equals

(∫𝑢=numbernumber𝑓(𝑢)d𝑢)(∫𝑣=numbernumber𝑔(𝑣)d𝑣).

For example, consider the following easy question and solution.

Sample Question

Evaluate

∫𝑥=01∫𝑦=0𝜋𝑒𝑥sin(𝑦)d𝑦d𝑥.

Solution. The integral can be written as:

∫𝑥=01𝑒𝑥(∫𝑦=0𝜋sin(𝑦)d𝑦)d𝑥.

The inner integral is

∫𝑦=0𝜋sin(𝑦)d𝑦=[−cos(𝑦)]𝑦=0𝜋=(−cos(𝜋))−(−cos(0))=(−(−1))−(−1)=1+1=2.

Substitute the result back into the integral:

∫𝑥=01𝑒𝑥⋅2d𝑥=2∫𝑥=01𝑒𝑥d𝑥=2[𝑒𝑥]𝑥=01=2(𝑒1−𝑒0)=2𝑒−2.

□

If you pay attention to the solution above, you’ll notice that in fact ∫𝑦=0𝜋sin(𝑦)d𝑦=2 is just a number, and it gets pulled out of the integral right away. So in effect, we actually have

∫𝑥=01∫𝑦=0𝜋𝑒𝑥sin(𝑦)d𝑦d𝑥=(∫𝑥=01𝑒𝑥d𝑥)(∫𝑦=0𝜋sin(𝑦)d𝑦).

This is a bit of a convenience feature that might save a bit of headspace. It’s a tiny optimization, but it’s worth pointing out.

Tip

Look for the common pattern

∫𝑢=numbernumber∫𝑣=numbernumber𝑓(𝑢)𝑔(𝑣)d𝑣d𝑢=(∫𝑢=numbernumber𝑓(𝑢)d𝑢)(∫𝑣=numbernumber𝑔(𝑣)d𝑣).

Remember, this doesn’t work if either the integrand doesn’t factor, or the limits of integration aren’t just numbers (i.e. the limit of 𝑣 depends on 𝑢).

As another example of a use case, in the polar integration we just did, we have

∫𝑟=01∫𝜃=02𝜋𝑟d𝜃d𝑟=(∫𝑟=01𝑟d𝑟)(∫𝜃=02𝜋d𝜃)=[𝑟22]𝑟=0𝑟=1⋅(2𝜋)=𝜋.

(Polar coordinates, covered next chapter, have this particular pattern a lot. Often the thing you’re integrating has no 𝜃 dependence at all.)

§23.7 [EXER] Exercises

Exercise 23.1. Let ℛ︀ be all the points on or inside the triangle with vertices (0,0), (1,2) and (2,1). Compute

∬ℛ︀(𝑥+𝑦)2𝑥𝑦d𝑥d𝑦.

(Recommended approach: use change of variables with 𝑢=𝑥+𝑦 and 𝑣=𝑥𝑦.)