Equation of a Tangent Line

Description:  In the following examples,  various curves will be graphed, the tangent line at different intervals will be graphed as well as the equation of the tangent line

By:  David Lystila

Modified 1/95:  Debra Woods

Slope of the tangent line

Nearly all mathematical activity in the sciences is devoted to various changes in the measure of quantities.  The study of the average rate of change of a function which is given as (f[b]-f[a])/(b-a) also known as the slope of a line. But what about the instantaneous rate of change?  What happens when the rate of change between two intervals is very, very close?  We will describe this as (f[x+h]-f[x])/h as h approaches zero.  The average rate of change in the graphics will be called the secant line and the instantaneous rate of change will be called the tangent line. In the example to follow, look how the line closes in around the point (1,1).

Clear[f,x,a,b,A,B,curveplot,line,label,dots]
f[x_]:=x^3
a =1;
b =1.5;
A:={a,f[a]}
B:={b,f[b]}
Clear[line,k]
line[k_] := Graphics[
                  Thickness[.008],
                  Line[{{a,f[a]},{k,f[k]}}]
                    ]
g[x_,k_]:=((f[k]-f[a])/(k-a)) (x-k)+f[k]
Clear[text]
text={Text["eq of sec line=",{.8,2.2},{1,0}],
						Text[N[f'[k] (x-k)+f[k]],{.8,2.2},{-1,0}]};
fline = Plot[x^3,{x,0,2.2},AspectRatio->1/2,
								PlotRange->{0,3},
								PlotStyle->{RGBColor[0,0,1],Thickness[.004]}];
plotline[k_] := Plot[g[x,k],{x,0,2},
                DisplayFunction->Identity];

Do[Show[{fline,line[k],plotline[k]},
AspectRatio->1/2,
DisplayFunction->$DisplayFunction,
Epilog->text,
AxesOrigin->{0,0}],{k,1.5,1,-.1}];

Clear[text]
text={Text["eq of tan line=",{.8,2.2},{1,0}],
						Text[N[f'[1] (x-1)+f[1]],{.8,2.2},{-1,0}]};
tan=Plot[f'[1] (x-1)+f[1],{x,0,2.2},
						AspectRatio->1/2,Epilog->text,
						DisplayFunction->Identity];
Show[fline,line[1],tan,AxesOrigin->{0,0},
						Epilog->text,DisplayFunction->$DisplayFunction];

In the last picture, we have the function, the point of tangency, and the equation of the tangent line.  In the following examples, notice how the tangent line tells us information about the corresponding curve.

The Sine Curve:  f[x]=Sine[x]

Clear[f,g,h,x,a]
f[x_] :=Sin[x];
jump:=Pi/4
Clear[tanline,point,text]
tanline := f'[a] (x-a)+f[a]
point   := {a,f[a]}
text = {Text["eq of tan line=",{-5,3},{1,0}],
                 Text[N[tanline],{-5,3},{-1,0}]};
Do[
			Plot[{tanline,f[x]},{x,-2Pi,2Pi},
								PlotRange->{{-2Pi,2Pi},{-5,5}},
								AspectRatio->Automatic,
								Epilog->text,
								PlotStyle->{{Thickness[.004]},
																			{Thickness[.008],RGBColor[0,0,1]}}],
			{a,-2 Pi, 2 Pi, jump}]

Notice the four examples of the sine curve and its accompanying tangent lines.  In the first example, notice the slope of the line.  It's negative,  and the sine curve is decreasing.  In the second example,  the tangent line is horizontal and notice that this is one of the low  points of the sine curve.  In the third case, the tangent line has a positive slope and the sine curve is increasing.  Lastly, the slope of the tangent line is zero or horizontal, and this is one of the high points of the sine curve.

The Exponential Function:  f[x]= E^x

In this portion we will examine the exponential function and look at some of the tangent lines for the graph.

Clear[tanline,text,x,b]
g[x_]:=E^x
tanline:=N[g'[b] (x-b)+g[b]]
text={Text["eq of tan line=",{-1,3},{1,0}],
						Text[N[tanline],{-1,3},{-1,0}]};
Do[Plot[{tanline,g[x]},{x,-4,2},
								PlotRange->{{-4,6},{-1,9}},
								AspectRatio->Automatic,
								Epilog->text,
								PlotStyle->{{Thickness[.004]},
																		{Thickness[.008],RGBColor[0,0,1]}}],
			{b,-4,2}]

In each of the following examples of the exponential function the slopes of the tangent lines were all positive,  thus indicating the exponential function is an increasing function.

The Natural Logrithmic Function:  f[x]=Log[x]

In this example we will explore the natural logrithmic function.  Notice the domain of the function, it is not defined for x less than or equal to zero.

Clear[tanline,text,x,c,h]
h[x_]:=Log[x]
tanline:=N[h'[c] (x-c)+h[c]]
text={Text["eq of tan line=",{1,2.5},{1,0}],
						Text[N[tanline],{1,2.5},{-1,0}]};
Do[Plot[{tanline,h[x]},{x,.1,5},
								PlotRange->{{-2,6},{-2,5}},
								AspectRatio->Automatic,
								Epilog->text,
								PlotStyle->{{Thickness[.004]},
																				{Thickness[.008],RGBColor[0,0,1]}}],
		{c,.5,5,.5}]

In each picture the tangent line has a positive slope and again notice the curve is increasing at each of these places.  The natural logrithmic function is an increasing function.

A Polynomial Function:  f[x]=2x‹+3x¤-12x

When we look at this polynomial notice how the curve behaves as well as the tangent lines.

Clear[tanline,text,x,d,j]
j[x_]:=2 x^3+3 x^2-12 x
tanline:=N[j'[d] (x-d)+j[d]]
text={Text["eq of tan line=",{3,-15},{1,0}],
						Text[N[tanline],{3,-15},{-1,0}]};
Do[Plot[{tanline,j[x]},{x,-4,4},
								PlotRange->{{-4,7},{-20,30}},
								Epilog->text,
								PlotStyle->{{Thickness[.004]},
																				{Thickness[.008],RGBColor[0,0,1]}}],
		{d,-4,4}]

In these graphs notice the first picture has a positive slope and the curve is increasing at this point.  The second picture has a tangent line that is horizontal and it is the highest point in a limited domain.  Thirdly, the slope of the tangent line is negative and the corresponding curve is deacreasing.  In the fourth example, the tangent line has a slope of zero and the graph has a low point in a limited domain.  Lastly, after we leave the low point the tangent line has a positive slope and the curve is increasing.

A Rational Function:  f[x]=(x+1)/x¤

In the following function watch what happens to the curve as we approach zero.  Also watch what happens as x approaches both positive and negative infinity.

Clear[tanline,text,x,e,k]
k[x_]:=(x+1)/x^2
tanline:=N[k'[e] (x-e)+k[e]]
text={Text["eq of tan line=",{-1,1.5},{1,0}],
						Text[N[tanline],{-1,1.5},{-1,0}]};
Do[Plot[{tanline,k[x]},{x,-4,4},
								PlotRange->{{-5,5},{-3,10}},
								Epilog->text,
								PlotStyle->{{Thickness[.004]},
																				{Thickness[.008],RGBColor[0,0,1]}}],
		{e,-3.5,4,1.5}]

In the first picture, the tangent line has a negative slope thus indicating the curve is decreasing.  Secondly, the tangent line has a slope of zero which tells us this should be a low point.  In the third graph the slope is positive and the curve is increasing.  The fourth  and the fifth picture both have a negative slope and tells us the function is decreasing is this region.  As the function approached negative infinity the function approached zero from the bottom and as x approached positive infinity the function approached zero from above.  As x closed in on zero from the right and the left the function approached positive infinity.

An Inverse Trig Function:  f[x]=ArcTan[x]

The graph of this inverse tangent function is interesting.  Notice the range of the function.  Watch what happens as x approaches positive and negative infinity.

Clear[tanline,text,x,f,a]
f[x_]:=ArcTan[x]
tanline:=N[f'[a] (x-a)+f[a]]
text={Text["eq of tan line=",{-2,1.5},{1,0}],
						Text[N[tanline],{-2,1.5},{-1,0}]};
Do[Plot[{tanline,f[x]},{x,-2 Pi,2 Pi},
									PlotRange->{{-7,7},{-2,3}},
									Epilog->text,
									PlotStyle->{{Thickness[.004]},
									{Thickness[.008],RGBColor[0,0,1]}}],
		{a,-2 Pi,2 Pi,Pi/4}]

In each picture shown the tangent line is positive implying that the inverse tangent function is an increasing function.  As x nears negative infinity the arctan function approaches -`/2 and as x nears positive infinity the arctan function approaches `/2.

Summary:

In each of the previous graphs notice how the tangent line (derivative) tells us information about the original curve.  When the slope of the tangent line is positive it indicates the curve is an increasing function; and when the slope of the line is negative it indicaties the function is decreasing.  Another observation that the derivative tells us is when the tangent line is horizontal (slope is zero) it identifies a critical point of the original function. A critical point yields a relative maximum or a relative minimum in a regional domain.