Inverse Functions: Arctangent and Angle Between Two Lines (Part 25)

The smallest angle between the non-perpendicular lines y = m_1 x + b_1 and y = m_1 x + b_2 can be found using the formula

\theta = \displaystyle \tan^{-1} \left( \left| \frac{m_1 - m_2}{1 + m_1 m_2} \right| \right).

A generation ago, this formula used to be taught in a typical Precalculus class (or, as it was called back then, analytical geometry). However, I find that analytic geometry has fallen out of favor in modern Precalculus courses.

Why does this formula work? Consider the graphs of y = m_1 x and y = m_1 x + b_1, and let’s measure the angle that the line makes with the positive x-axis.

dotproduct5The lines y = m_1 x + b_1 and y = m_1 x are parallel, and the x-axis is a transversal intersecting these two parallel lines. Therefore, the angles that both lines make with the positive x-axis are congruent. In other words, the + b_1 is entirely superfluous to finding the angle \theta_1. The important thing that matters is the slope of the line, not where the line intersects the y-axis.

The point (1, m_1) lies on the line y = m_1 x, which also passes through the origin. By definition of tangent, \tan \theta_1 can be found by dividing the y- and x-coordinates:

\tan \theta_1 = \displaystyle \frac{m}{1} = m_1.

green linedotproduct6

 

We now turn to the problem of finding the angle between two lines. As noted above, the y-intercepts do not matter, and so we only need to find the smallest angle between the lines y = m_1 x and y = m_2 x.

The angle \theta will either be equal to \theta_1 - \theta_2 or \theta_2 - \theta_1, depending on the values of m_1 and m_2. Let’s now compute both \tan (\theta_1 - \theta_2) and \tan (\theta_2 - \theta_1) using the formula for the difference of two angles:

\tan (\theta_1 - \theta_2) = \displaystyle \frac{\tan \theta_1 - \tan \theta_2}{1 + \tan \theta_1 \tan \theta_2}

\tan (\theta_2 - \theta_1) = \displaystyle \frac{\tan \theta_2 - \tan \theta_1}{1 + \tan \theta_2 \tan \theta_1}

Since the smallest angle \theta must lie between 0 and \pi/2, the value of \tan \theta must be positive (or undefined if \theta = \pi/2… for now, we’ll ignore this special case). Therefore, whichever of the above two lines holds, it must be that

\tan \theta = \displaystyle \left| \frac{\tan \theta_1 - \tan \theta_2}{1 + \tan \theta_1 \tan \theta_2} \right|

We now use the fact that m_1 = \tan \theta_1 and m_2 = \tan \theta_2:

\tan \theta = \displaystyle \left| \frac{m_1 - m_2}{1 + m_1 m_2} \right|

\theta = \tan^{-1} \left( \displaystyle \left| \frac{m_1 - m_2}{1 + m_1 m_2} \right| \right)

green line

The above formula only applies to non-perpendicular lines. However, the perpendicular case may be remembered as almost a special case of the above formula. After all, \tan \theta is undefined at \theta = \pi/2 = 90^\circ, and the right hand side is also undefined if 1 + m_1 m_2 = 0. This matches the theorem that the two lines are perpendicular if and only if m_1 m_2 = -1, or that the slopes of the two lines are negative reciprocals.

Inverse Functions: Arctangent and Angle Between Two Lines (Part 24)

Here’s a straightforward application of arctangent that, a generation ago, used to be taught in a typical Precalculus class (or, as it was called back then, analytical geometry).

Find the smallest angle between the lines y= 3x and y = -x/2.

dotproduct3

This problem is almost equivalent to finding the angle between the vectors \langle 1,3 \rangle and \langle -2,1 \rangle. I use the caveat almost because the angle between two vectors could be between 0 and \pi, while the smallest angle between two lines must lie between 0 and \pi/2.

This smallest angle can be found using the formula

\theta = \displaystyle \tan^{-1} \left( \left| \frac{m_1 - m_2}{1 + m_1 m_2} \right| \right),

where m_1 and m_2 are the slopes of the two lines. In the present case,

\theta = \tan^{-1} \left( \left| \displaystyle \frac{ 3 - (-1/2) }{1 + (3)(-1/2)} \right| \right)

\theta = \tan^{-1} \left( \left| \displaystyle \frac{7/2}{-1/2} \right| \right)

\theta = \tan^{-1} 7

\theta \approx 81.87^\circ.

Not surprisingly, we obtain the same answer that we obtained a couple of posts ago using arccosine. The following picture makes clear why \tan^{-1} 7 = \cos^{-1} \displaystyle \frac{1}{\sqrt{50}}.

dotproduct4In tomorrow’s post, I’ll explain why the above formula actually works.

 

Inverse Functions: Arccosine and Arctangent (Part 18)

In this series, we’ve seen that the inverse of function that fails the horizontal line test can be defined by appropriately restricting the domain of the function. For example, we now look at the graph of y = \cos x:

cos1As with the graph of y = \sin x, we select a section that satisfies the horizontal line test and ignore the rest of the graph. (I described this in more rigorous terms when I considered arcsine, so I will not repeat the rigor here.) There are plenty of choices that could be made; by tradition, the interval [0,\pi] is chosen.

cos2Reflecting only the half-wave of the cosine graph on the interval [0,\pi] through the line y = x produces the graph of y= \cos^{-1} x. Again, to assist my students when graphing this function, I point out that the graph of cosine has horizontal tangent lines at the points (0,1) and (\pi,-1). Therefore, after reflecting through the line y = x, we see that the graph of \cos^{-1} x has vertical tangent lines at (1,0) and (-1,\pi).

cos3green lineThe same logic applies when defining the arctangent function. By tradition, the interval (-\pi/2,\pi/2) is chosen as the section of the graph of y = \tan x that satisfies the horizontal line test.

tan1Reflecting only the half-wave of the cosine graph on the interval [0,\pi] through the line y = x produces the graph of y= \tan^{-1} x. Like the (more complicated) logistic growth function, this function has two different horizontal asymptotes that govern the behavior of the function as x \to \pm \infty.

tan2green line

So here are the rules that I want my Precalculus students to memorize:

y = \sin^{-1} x means that x = \sin y and \displaystyle -\frac{\pi}{2} \le y \le \displaystyle \frac{\pi}{2}

y = \cos^{-1} x means that x = \cos y and 0 \le y \le \pi

y = \sin^{-1} x means that x = \sin y and \displaystyle -\frac{\pi}{2} < y < \displaystyle \frac{\pi}{2}

Students using forget that the range of arccosine is different than the other two, and I’ll usually have to produce the graph of y = \cos x to explain and re-explain why this one is different.

Because these functions are defined on restricted domains, the usual funny things can happen. For example,

\cos^{-1} (\cos 2\pi) = \cos^{-1} 1 = 0 \ne 2 \pi

\tan^{-1} \left( \tan \displaystyle \frac{3\pi}{4} \right) = \tan^{-1} (-1) = -\displaystyle \frac{\pi}{4} \ne \displaystyle \frac{3\pi}{4}

 

Arctangents and showmanship

This story comes from Fall 1996, my first semester as a college professor. I was teaching a Precalculus class, and the topic was vectors. I forget the exact problem (believe me, I wish I could remember it), but I was going over the solution of a problem that required finding \tan^{-1}(7). I told the class that I had worked this out ahead of time, and that the approximate answer was 82^o. Then I used that angle for whatever I needed it for and continued until obtaining the eventual solution.

(By the way, I now realize that I was hardly following best practices by computing that angle ahead of time. Knowing what I know now, I should have brought a calculator to class and computed it on the spot. But, as a young professor, I was primarily concerned with getting the answer right, and I was petrified of making a mistake that my students could repeat.)

After solving the problem, I paused to ask for questions. One student asked a good question, and then another.

Then a third student asked, “How did you know that \tan^{-1}(7) was 82^o?

Suppressing a smile, I answered, “Easy; I had that one memorized.”

The class immediately erupted… some with laughter, some with disbelief. (I had a terrific rapport with those students that semester; part of the daily atmosphere was the give-and-take with any number of exuberant students.) One guy in the front row immediately challenged me: “Oh yeah? Then what’s \tan^{-1}(9)?

I started to stammer, “Uh, um…”

“Aha!” they said. “He’s faking it.” They start pulling out their calculators.

Then I thought as fast as I could. Then I realized that I knew that \tan 82^o \approx 7, thanks to my calculation prior to class. I also knew that \displaystyle \lim_{x \to 90^-} \tan x = \infty since the graph of y = \tan x has a vertical asymptote at x = \pi/2 = 90^o. So the solution to \tan x = 9 had to be somewhere between 82^o and 90^o.

So I took a total guess. “84^o,” I said, faking complete and utter confidence.

Wouldn’t you know it, I was right. (The answer is about 83.66^o.)

In stunned disbelief, the guy who asked the question asked, “How did you do that?”

I was reeling in shock that I guessed correctly. But I put on my best poker face and answered, “I told you, I had it memorized.” And then I continued with the next example. For the rest of the semester, my students really thought I had it memorized.

To this day, this is my favorite stunt that I ever pulled off in front of my students.

Reminding students about Taylor series (Part 5)

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 5. That was easy; let’s try another one. Now let’s try f(x) = \displaystyle \frac{1}{1-x} = (1-x)^{-1}.

What’s f(0)? Plugging in, we find f(x) = \displaystyle \frac{1}{1-0} = 1.

Next, to find f'(0), we first find f'(x). Using the Chain Rule, we find f'(x) = -(1-x)^{-2} \cdot (-1) = \displaystyle \frac{1}{(1-x)^2}, so that f'(0) = 1.

Next, we differentiate again: f'(x) = (-2) \cdot (1-x)^{-3} \cdot (-1) = \displaystyle \frac{2}{(1-x)^3}, so that f''(0) = 2.

Hmmm… no obvious pattern yet… so let’s keep going.

For the next term, f'''(x) = (-3) \cdot 2(1-x)^{-4} \cdot (-1) = \displaystyle \frac{6}{(1-x)^4}, so that f'''(0) = 6.

For the next term, f^{(4)}(x) = (-4) \cdot 6(1-x)^{-5} \cdot (-1) = \displaystyle \frac{24}{(1-x)^5}, so that f^{(4)}(0) = 24.

Oohh… it’s the factorials again! It looks like f^{(n)}(0) = n!, and this can be formally proved by induction.

Plugging into the series, we find that

\displaystyle \frac{1}{1-x} = \sum_{n=0}^\infty \frac{n!}{n!} x^n = \sum_{n=0}^\infty x^n = 1 + x + x^2 + x^3 + \dots.

Like the series for e^x, this series converges quickest for x \approx 0. Unlike the series for e^x, this series does not converge for all real numbers. As can be checked with the Ratio Test, this series only converges if |x| < 1.

The right-hand side is a special kind of series typically discussed in precalculus. (Students often pause at this point, because most of them have forgotten this too.) It is an infinite geometric series whose first term is $1$ and common ratio $x$. So starting from the right-hand side, one can obtain the left-hand side using the formula

a + ar + ar^2 + ar^3 + \dots = \displaystyle \frac{a}{1-r}

by letting a=1 and $r=x$. Also, as stated in precalculus, this series only converges if the common ratio satisfies $|r| < 1$, as before.

In other words, in precalculus, we start with the geometric series and end with the function. With Taylor series, we start with the function and end with the series.

green line

Step 6. A whole bunch of other Taylor series can be quickly obtained from the one for \displaystyle \frac{1}{1-x}. Let’s take the derivative of both sides (and ignore the fact that one should prove that differentiating this infinite series term by term is permissible). Since

\displaystyle \frac{d}{dx} \left( \frac{1}{1-x} \right) = \frac{1}{(1-x)^2}

and

\displaystyle \frac{d}{dx} \left( 1 + x + x^2 + x^3 + x^4 + \dots \right) = 1 + 2x + 3x^2 + 4x^3 + \dots,

we have

\displaystyle \frac{1}{(1-x)^2} = 1 + 2x + 3x^2 + 4x^3 + \dots.

____________________

Next, let’s replace x with -x in the Taylor series in Step 5, obtaining

\displaystyle \frac{1}{1+x} = 1 - x + x^2 - x^3 + x^4 - x^5 \dots

Now let’s take the indefinite integral of both sides:

\displaystyle \int \frac{dx}{1+x} = \int \left( 1 - x + x^2 - x^3 + x^4 - x^5 \dots \right) \, dx

\ln(1+x) = \displaystyle x - \frac{x^2}{2} + \frac{x^3}{3} -\frac{ x^4}{4} + \frac{x^5}{5} -\frac{ x^6}{6} \dots + C

To solve for the constant of integration, let x = 0:

\ln(1) = 0+ C \Longrightarrow C = 0

Plugging back in, we conclude that

\ln(1+x) = x - \displaystyle \frac{x^2}{2} + \frac{x^3}{3} -\frac{ x^4}{4} + \frac{x^5}{5} -\frac{ x^6}{6} \dots

The Taylor series expansion for \ln(1-x) can be found by replacing x with -x:

\ln(1-x) = -x - \displaystyle \frac{x^2}{2} - \frac{x^3}{3} -\frac{ x^4}{4} - \frac{x^5}{5} -\frac{ x^6}{6} \dots

Subtracting, we find

\ln(1+x) - \ln(1-x) = \ln \displaystyle \left( \frac{1+x}{1-x} \right) = 2x + \frac{2x^3}{3}+ \frac{2x^5}{5} \dots

My understanding is that this latter series is used by calculators when computing logarithms.

____________________

Next, let’s replace x with -x^2 in the Taylor series in Step 5, obtaining

\displaystyle \frac{1}{1+x^2} = 1 - x^2 + x^4 - x^6 + x^8 - x^{10} \dots

Now let’s take the indefinite integral of both sides:

\displaystyle \int \frac{dx}{1+x^2} = \int \left(1 - x^2 + x^4 - x^6 + x^8 - x^{10} \dots\right) \, dx

\tan^{-1}x = \displaystyle x - \frac{x^3}{3} + \frac{x^5}{5} -\frac{ x^7}{7} + \frac{x^9}{9} -\frac{ x^{11}}{11} \dots + C

To solve for the constant of integration, let x = 0:

\tan^{-1}(1) = 0+ C \Longrightarrow C = 0

Plugging back in, we conclude that

\tan^{-1}x = \displaystyle x - \frac{x^3}{3} + \frac{x^5}{5} -\frac{ x^7}{7} + \frac{x^9}{9} -\frac{ x^{11}}{11} \dots

____________________

In summary, a whole bunch of Taylor series can be extracted quite quickly by differentiating and integrating from a simple infinite geometric series. I’m a firm believer in minimizing the number of formulas that I should memorize. Any time I personally need any of the above series, I’ll quickly use the above steps to derive them from that of \displaystyle \frac{1}{1-x}.