How I Impressed My Wife: Part 6a

This series was inspired by a question that my wife asked me: calculate

Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}

Originally, I multiplied the top and bottom of the integrand by \tan^2 x and performed a substitution. However, as I’ve discussed in this series, there are four different ways that this integral can be evaluated.
Starting with today’s post, I’ll begin a fifth method. I really like this integral, as it illustrates so many different techniques of integration as well as the trigonometric tricks necessary for computing some integrals.
green lineSince Q is independent of a, I can substitute any convenient value of a that I want without changing the value of Q. As shown in previous posts, substituting a =0 yields the following simplification:

Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}

= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + 2 \cdot 0 \cdot \sin x \cos x + (0^2 + b^2) \sin^2 x}

= \displaystyle \int_{0}^{2\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}

= \displaystyle \int_{-\pi}^{\pi} \frac{dx}{\cos^2 x + b^2 \sin^2 x}

= \displaystyle \int_{-\infty}^{\infty} \frac{ 2(1+u^2) du}{u^4 + (4 b^2 - 2) u^2 + 1}

Earlier, I evaluated this last integral using partial fractions, separating into the cases |b| = 1, |b| > 1, and |b| < 1. Now, I’ll calculate this same integral using contour integration. (See Wikipedia and Mathworld for more details.)

It turns out that Q can be rewritten as

Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1},

where C_R is the contour in the complex plane shown above (graphic courtesy of Mathworld). That’s because

\displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}

= \displaystyle \lim_{R \to \infty} \int_{-R}^R \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} + \lim_{R \to \infty} \int_{\gamma_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}

= \displaystyle \int_{-\infty}^{\infty} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} + \lim_{R \to \infty} \int_{\gamma_R} \frac{ 2(1+z^2) du}{z^4 + (4 b^2 - 2) z^2 + 1}

= Q + \displaystyle \lim_{R \to \infty} \int_{\gamma_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1}

To show that the limit of the last integral is equal to 0, I use the parameterization z = R e^{i \theta}, so that dz = i R e^{i \theta}:

\displaystyle \lim_{R \to \infty} \left| \int_{\gamma_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1} \right|

= \displaystyle \lim_{R \to \infty} \left| \int_0^{\pi} \frac{ 2R(1+R^2 e^{2i\theta}) d\theta}{R^4 e^{4 i\theta} + (4 b^2 - 2) R^2 e^{2i\theta} + 1} \right|

\le \displaystyle \lim_{R \to \infty} \pi \max_{0 \le \theta \le \pi} \left| \frac{ 2R(1+R^2 e^{2i\theta})}{R^4 e^{4 i\theta} + (4 b^2 - 2) R^2 e^{2i\theta} + 1} \right|

= \displaystyle \pi \max_{0 \le \theta \le \pi} \lim_{R \to \infty} \left| \frac{ 2R(1+R^2 e^{2i\theta})}{R^4 e^{4 i\theta} + (4 b^2 - 2) R^2 e^{2i\theta} + 1} \right|

= \displaystyle \pi \max_{0 \le \theta \le \pi} 0

= 0.

The above limit is equal to zero because the numerator grows like R^3 while the denominator grows like R^4. (This can be more laboriously established using L’Hopital’s rule).

Therefore, I have shown that

Q = \displaystyle \lim_{R \to \infty} \oint_{C_R} \frac{ 2(1+z^2) dz}{z^4 + (4 b^2 - 2) z^2 + 1},

and this contour integral can be computed using residues.

green line

I’ll continue with this fifth evaluation of the integral, starting with the case |b| = 1, in tomorrow’s post.

How I Impressed My Wife: Part 4b

Previously in this series, I have used two different techniques to show that

Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x} = \displaystyle \frac{2\pi}{|b|}.

Originally, my wife had asked me to compute this integral by hand because Mathematica 4 and Mathematica 8 gave different answers. At the time, I eventually obtained the solution by multiplying the top and bottom of the integrand by \sec^2 x and then employing the substitution u = \tan x (after using trig identities to adjust the limits of integration).
But this wasn’t the only method I tried. Indeed, I tried two or three different methods before deciding they were too messy and trying something different. So, for the rest of this series, I’d like to explore different ways that the above integral can be computed.
green lineLet me backtrack to a point in the middle of the previous solution:

Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}

= \displaystyle \int_0^{2\pi} \frac{2 \, dx}{1+\cos 2x + 2 a \sin 2x + (a^2 + b^2)(1-\cos 2x)}

= 2 \displaystyle \int_0^{2\pi} \frac{d\theta}{(1+a^2+b^2) + 2 a \sin \theta + (1 - a^2 - b^2) \cos \theta}

= 2 \displaystyle \int_{0}^{2\pi} \frac{d\theta}{S + R \cos (\theta - \alpha)}

= 2 \displaystyle \int_{0}^{2\pi} \frac{d\phi}{S + R \cos \phi},

where R = \sqrt{(2a)^2 + (1-a^2-b^2)^2} and S = 1 + a^2 + b^2 (and \alpha is a certain angle that is now irrelevant at this point in the calculation).

Earlier in this series, I used the magic substitution u = \tan \displaystyle \frac{\phi}{2} to evaluate this last integral. Now, I’ll instead use contour integration; see Wikipedia for more details. I will use Euler’s formula as a substitution (see here and here for more details):

z = e^{i \phi} = \cos \phi + i \sin \phi,

so that the integral Q is transformed to a contour integral in the complex plane. Under this substitution, as discussed in yesterday’s post,

\cos \phi = \displaystyle \frac{1}{2} \left[z + \displaystyle \frac{1}{z} \right]

and

d\phi = \displaystyle -\frac{i}{z} dz

Employing this substitution, the region of integration changes from 0 \le \phi \le 2\pi to a the unit circle C, a closed counterclockwise contour in the complex plane:

Q = 2 \displaystyle \oint_C \frac{\displaystyle -\frac{i}{z} dz}{S + \displaystyle \frac{R}{2} \left[z + \displaystyle \frac{1}{z} \right]}

= -4i \displaystyle \oint_C \frac{dz}{Rz^2 + 2Sz + R}

= \displaystyle -\frac{4i}{R} \oint_C \frac{dz}{z^2 + 2\frac{S}{R}z + 1}

green lineWhile this looks integral in the complex plane looks a lot more complicated than a regular integral, it’s actually a lot easier to compute using residues. I’ll discuss the computation of this contour integral in tomorrow’s post.

How I Impressed My Wife: Part 4a

Previously in this series, I have used two different techniques to show that

Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x} = \displaystyle \frac{2\pi}{|b|}.

Originally, my wife had asked me to compute this integral by hand because Mathematica 4 and Mathematica 8 gave different answers. At the time, I eventually obtained the solution by multiplying the top and bottom of the integrand by \sec^2 x and then employing the substitution u = \tan x (after using trig identities to adjust the limits of integration).
But this wasn’t the only method I tried. Indeed, I tried two or three different methods before deciding they were too messy and trying something different. So, for the rest of this series, I’d like to explore different ways that the above integral can be computed.
green lineLet me backtrack to a point in the middle of the previous solution:

Q = \displaystyle \int_0^{2\pi} \frac{dx}{\cos^2 x + 2 a \sin x \cos x + (a^2 + b^2) \sin^2 x}

= \displaystyle \int_0^{2\pi} \frac{2 \, dx}{1+\cos 2x + 2 a \sin 2x + (a^2 + b^2)(1-\cos 2x)}

= 2 \displaystyle \int_0^{2\pi} \frac{d\theta}{(1+a^2+b^2) + 2 a \sin \theta + (1 - a^2 - b^2) \cos \theta}

= 2 \displaystyle \int_{0}^{2\pi} \frac{d\theta}{S + R \cos (\theta - \alpha)}

= 2 \displaystyle \int_{0}^{2\pi} \frac{d\phi}{S + R \cos \phi},

where R = \sqrt{(2a)^2 + (1-a^2-b^2)^2} and S = 1 + a^2 + b^2 (and \alpha is a certain angle that is now irrelevant at this point in the calculation).

In the previous solution, I used the “magic substitution” u = \tan \displaystyle \frac{\phi}{2} to convert the last integrand to a simple rational function. Starting today, I’ll use a completely different technique to compute this last integral.

The technique that I’ll use is contour integration; see Wikipedia for more details. I will use Euler’s formula as a substitution (see here and here for more details):

z = e^{i \phi} = \cos \phi + i \sin \phi,

so that the integral Q is transformed to a contour integral in the complex plane.

Under this substitution,

\displaystyle \frac{1}{z} = e^{-i\phi} = \cos(-\phi) + i \sin(-\phi) = \cos \phi - i \sin \phi

Using these last two equations, I can solve for \cos \phi and \sin \phi in terms of z and \displaystyle \frac{1}{z}. I’ll begin with \cos \phi:

z + \displaystyle \frac{1}{z} = \cos \phi + i \sin \phi + \cos \phi - i \sin \phi

z + \displaystyle \frac{1}{z} = 2 \cos \phi

\displaystyle \frac{1}{2} \left[z + \displaystyle \frac{1}{z} \right] = \cos \phi

Though not necessary for this particular, let me solve for \sin \phi for completeness:

z - \displaystyle \frac{1}{z} = \cos \phi + i \sin \phi - [ \cos \phi - i \sin \phi]

z - \displaystyle \frac{1}{z} = 2i \sin \phi

\displaystyle \frac{1}{2i} \left[z - \displaystyle \frac{1}{z} \right] = \sin\phi

 Finally, let me solve for the differential d\phi:

z = e^{i \phi}

dz = i e^{i \phi} d\phi

\displaystyle \frac{1}{i} e^{-i \phi} dz = d\phi

-i e^{-i \phi} dz = d\phi

\displaystyle -\frac{i}{z} dz = d\phi

green line I’ll continue with this different method of evaluating this integral in tomorrow’s post.

Full lesson plan: Modular multiplication and encryption

Over the summer, I occasionally teach a small summer math class for my daughter and her friends around my dining room table. Mostly to preserve the memory for future years… and to provide a resource to my friends who wonder what their children are learning… I’ll write up the best of these lesson plans in full detail.

In this lesson, the students practiced their skills with multiplication and division to create modular multiplication tables. Though this is a concept ordinarily first encountered in an undergraduate class in number theory or abstract algebra, there’s absolutely no reason why elementary students who’ve mastered multiplication can’t do this exercise. This exercise strengthens the notion of dividing with a remainder and leads to a fun application with encrypting and decrypting secret messages. Indeed, this activity made be viewed as a child-appropriate version of the RSA encryption algorithm that’s used every time we use our credit cards. This was mentioned in two past posts: https://meangreenmath.com/2013/10/17/engaging-students-finding-prime-factorizations and https://meangreenmath.com/2013/07/11/cryptography-as-a-teaching-tool

This lesson plan is written in a 5E format — engage, explore, explain, elaborate, evaluate — which promotes inquiry-based learning and fosters student engagement.

Lesson Plan: Kid RSA Lesson

Other Documents:

Vocabulary Sheet

Three Letter Words

RSA Numbers

 Modular Multiplication Tables

Modular Multiplication Assessment

Modular Multiplcation Practice

Kid RSA

Full lesson plan: Platonic solids

Over the summer, I occasionally teach a small summer math class for my daughter and her friends around my dining room table. Mostly to preserve the memory for future years… and to provide a resource to my friends who wonder what their children are learning… I’ll write up the best of these lesson plans in full detail.

This was the first lesson that I taught to this audience: constructing the five regular polyhedra and inductively deriving Euler’s formula. This lesson plan is written in a 5E format — engage, explore, explain, elaborate, evaluate — which promotes inquiry-based learning and fosters student engagement.

Platonic Solids Lesson

Post Assessment 1

Post Assessment 2

V-E-F Chart

Vocabulary Sheet

Reminding students about Taylor series (Part 6)

Sadly, at least at my university, Taylor series is the topic that is least retained by students years after taking Calculus II. They can remember the rules for integration and differentiation, but their command of Taylor series seems to slip through the cracks. In my opinion, the reason for this lack of retention is completely understandable from a student’s perspective: Taylor series is usually the last topic covered in a semester, and so students learn them quickly for the final and quickly forget about them as soon as the final is over.

Of course, when I need to use Taylor series in an advanced course but my students have completely forgotten this prerequisite knowledge, I have to get them up to speed as soon as possible. Here’s the sequence that I use to accomplish this task. Covering this sequence usually takes me about 30 minutes of class time.

I should emphasize that I present this sequence in an inquiry-based format: I ask leading questions of my students so that the answers of my students are driving the lecture. In other words, I don’t ask my students to simply take dictation. It’s a little hard to describe a question-and-answer format in a blog, but I’ll attempt to do this below.

In the previous posts, I described how I lead students to the definition of the Maclaurin series

f(x) = \displaystyle \sum_{k=0}^{\infty} \frac{f^{(k)}(0)}{k!} x^k,

which converges to f(x) within some radius of convergence for all functions that commonly appear in the secondary mathematics curriculum.

green line

Step 7. Let’s now turn to trigonometric functions, starting with f(x) = \sin x.

What’s f(0)? Plugging in, we find f(0) = \sin 0 = 0.

As before, we continue until we find a pattern. Next, f'(x) = \cos x, so that f'(0) = 1.

Next, f''(x) = -\sin x, so that f''(0) = 0.

Next, f'''(x) = -\cos x, so that f''(0) = -1.

No pattern yet. Let’s keep going.

Next, f^{(4)}(x) = \sin x, so that f^{(4)}(0) = 0.

Next, f^{(5)}(x) = \cos x, so that f^{(5)}(0) = 1.

Next, f^{(6)}(x) = -\sin x, so that f^{(6)}(0) = 0.

Next, f^{(7)}(x) = -\cos x, so that f^{(7)}(0) = -1.

OK, it looks like we have a pattern… albeit more awkward than the patterns for e^x and \displaystyle \frac{1}{1-x}. Plugging into the series, we find that

\displaystyle \sin x= x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} \dots

If we stare at the pattern of terms long enough, we can write this more succinctly as

\sin x = \displaystyle \sum_{n=0}^\infty (-1)^n \frac{x^{2n+1}}{(2n+1)!}

The (-1)^n term accounts for the alternating signs (starting on positive with n=0), while the 2n+1 is needed to ensure that each exponent and factorial is odd.

Let’s see… \sin x has a Taylor expansion that only has odd exponents. In what other sense are the words “sine” and “odd” associated?

In Precalculus, a function f(x) is called odd if f(-x) = -f(x) for all numbers x. For example, f(x) = x^9 is odd since f(-x) = (-x)^9 = -x^9 since 9 is a (you guessed it) an odd number. Also, \sin(-x) = -\sin x, and so \sin x is also an odd function. So we shouldn’t be that surprised to see only odd exponents in the Taylor expansion of \sin x.

A pedagogical note: In my opinion, it’s better (for review purposes) to avoid the \displaystyle \sum notation and simply use the “dot, dot, dot” expression instead. The point of this exercise is to review a topic that’s been long forgotten so that these Taylor series can be used for other purposes. My experience is that the \displaystyle \sum adds a layer of abstraction that students don’t need to overcome for the time being.

green line

Step 8. Let’s now turn try f(x) = \cos x.

What’s f(0)? Plugging in, we find f(0) = \cos 1 = 0.

Next, f'(x) = -\sin x, so that f'(0) = 0.

Next, f''(x) = -\cos x, so that f'(0) = -1.

It looks like the same pattern of numbers as above, except shifted by one derivative. Let’s keep going.

Next, f'''(x) = \sin x, so that f'''(0) = 0.

Next, f^{(4)}(x) = \cos x, so that f^{(4)}(0) = 1.

Next, f^{(5)}(x) = -\sin x, so that f^{(5)}(0) = 0.

Next, f^{(6)}(x) = -\cos x, so that f^{(6)}(0) = -1.

OK, it looks like we have a pattern somewhat similar to that of $\sin x$, except only involving the even terms. I guess that shouldn’t be surprising since, from precalculus we know that \cos x is an even function since \cos(-x) = \cos x for all x.

Plugging into the series, we find that

\displaystyle \cos x= 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} \dots

If we stare at the pattern of terms long enough, we can write this more succinctly as

\cos x = \displaystyle \sum_{n=0}^\infty (-1)^n \frac{x^{2n}}{(2n)!}

green line

As we saw with e^x, the above series converge quickest for values of x near 0. In the case of \sin x and \cos x, this may be facilitated through the use of trigonometric identities, thus accelerating convergence.

For example, the series for \cos 1000^o will converge quite slowly (after converting 1000^o into radians). However, we know that

\cos 1000^o= \cos(1000^o - 720^o) =\cos 280^o

using the periodicity of \cos x. Next, since $\latex 280^o$ is in the fourth quadrant, we can use the reference angle to find an equivalent angle in the first quadrant:

\cos 1000^o = \cos 280^o = \cos(360^o - 80^o) = \cos 80^o

Finally, using the cofunction identity \cos x = \sin(90^o - x), we find

\cos 1000^o = \cos 80^o = sin(90^o - 80^o) = \sin 10^o.

In this way, the sine or cosine of any angle can be reduced to the sine or cosine of some angle between 0^o and $45^o = \pi/4$ radians. Since \pi/4 < 1, the above power series will converge reasonably rapidly.

green line

Step 10. For the final part of this review, let’s take a second look at the Taylor series

e^x = \displaystyle 1 + x + \frac{x^2}{2} + \frac{x^3}{3} + \frac{x^4}{4} + \frac{x^5}{5} + \frac{x^6}{6} + \frac{x^7}{7} + \dots

Just to be silly — for no apparent reason whatsoever, let’s replace x by ix and see what happens:

e^{ix} = \displaystyle 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} \dots + i \left[\displaystyle x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} \dots \right]

after separating the terms that do and don’t have an i.

Hmmmm… looks familiar….

So it makes sense to define

e^{ix} = \cos x + i \sin x,

which is called Euler’s formula, thus proving an unexpected connected between e^x and the trigonometric functions.