Application Center - Maplesoft

App Preview:

Finding the equation of a tangent line

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

L6-equationOfTangentLine.mws

Calculus I

Lesson 6: Finding the Equation of a Tangent Line

> restart: with(plots):

Warning, the name changecoords has been redefined

First we'll demonstrate graphically the meaning of a tangent line in an animation. Afterwards, we'll show how to find the equation of a line tangent to a function at a given point.

> f := x -> x^3 - 4*x^2 + x - 1;

f := proc (x) options operator, arrow; x^3-4*x^2+x-...

> T := (x,a) -> f(a) + (x - a) * D(f)(a) :

> display(plot(f(x), x=-2..6, y= -20..15, thickness = 3, color = red),
animate(T(x,t), x=-2..6, t=-2..5, view = -20.. 15, color = blue, frames=60));

[Maple Plot]

Let's find the equation of the tangent line for the following

functions at the indicated points. Plot the function and tangent

line on the same plot.

a) x = 2, f(x) = 3*x-x^2

b) x = 1, g(x) = x^3-sqrt(x)

c) x = Pi /6, h(x) = 1+3*cos(x)

d) x = 0, f(x) = (3+x)/(1-x^2)

a)

> f := x -> 3*x - x^2;

f := proc (x) options operator, arrow; 3*x-x^2 end ...

> D(f);

proc (x) options operator, arrow; 3-2*x end proc

> df:= x -> 3 - 2*x;

df := proc (x) options operator, arrow; 3-2*x end p...

> f(2);

2

> df(2);

-1

The tangent line passes through the point (2,2) and has slope -1.

> tl:= x -> 2 -(x - 2);

tl := proc (x) options operator, arrow; 4-x end pro...

> plot({f(x), tl(x)}, x = 0..4, color=[blue,brown]);

[Maple Plot]

b)

> restart:

> g:=x -> x^3 - sqrt(x);

g := proc (x) options operator, arrow; x^3-sqrt(x) ...

> D(g);

proc (x) options operator, arrow; 3*x^2-1/2*1/sqrt(...

> dg:= x -> 3*x^2 - (0.5)*(1 / (sqrt(x)));

dg := proc (x) options operator, arrow; 3*x^2-.5/sq...

> g(1);

0

> dg(1);

2.5

The tangent line passed through the point (1,0) and has slope 2.5

> tl:= x -> (2.5)*(x - 1);

tl := proc (x) options operator, arrow; 2.5*x-2.5 e...

> plot({g(x),tl(x)}, x = -1..3, color=[brown, blue]);

[Maple Plot]

c)

> restart:

> h:= x-> 1 + 3*cos(x);

h := proc (x) options operator, arrow; 1+3*cos(x) e...

> D(h);

proc (x) options operator, arrow; -3*sin(x) end pro...

> dh:= x ->-3 * sin(x);

dh := proc (x) options operator, arrow; -3*sin(x) e...

> h(Pi/6);

1+3/2*sqrt(3)

> evalf(%);

3.598076212

> dh(Pi/6);

-3/2

The tangent line passes through the point ( Pi/6, 1+3/2*sqrt(3) ) and has slope -3/2 .

> tl:= x -> 1 + (3/2)*(sqrt(3)) - (3/2)*(x - Pi/6);

tl := proc (x) options operator, arrow; 1+3/2*sqrt(...

> plot({tl(x),h(x)}, x = 0..Pi, color=[blue,brown]);

[Maple Plot]

d)

> restart:

> f := x -> (3 + x)/(1 - x^2);

f := proc (x) options operator, arrow; (3+x)/(1-x^2...

> D(f);

proc (x) options operator, arrow; 1/(1-x^2)+2*(3+x)...

> df:= x -> 1/(1 - x^2) + 2* ( ((3 + x)*x)/( ( 1 - x^2)^2));

df := proc (x) options operator, arrow; 1/(1-x^2)+2...

> f(0);

3

> df(0);

1

The tangent line passes through the point (0,3) and has slope 1.

>

> tl:= x -> 3 + x;

tl := proc (x) options operator, arrow; 3+x end pro...

> plot({f(x),tl(x)}, x = -0.5..0.5, color=[blue,brown]);

[Maple Plot]

2) Find the derivative of each of the following functions.

Plot the function and the derivative on the same axes.

a) g (x) = -2 for x > 0

= 3 - x for x <= 0

b) f(x) = x^2 for x < 1

= 2*x-1 for x >= 1

c) f(x) = x^3 for x < -1

= 1+2*x^2 for -1 <= x < 2

= 4*x+1 for x >= 2

a)

> restart:

> g:= x -> piecewise(x > 0, -2, 3 - x);

g := proc (x) options operator, arrow; piecewise(0 ...

> D(g);

proc (x) options operator, arrow; piecewise(x < 0,-...

> dg:= x -> piecewise(x > 0, 0, -1);

dg := proc (x) options operator, arrow; piecewise(0...

> plot({g(x),dg(x)}, x = -3..3, discont=true, color=[blue, brown]);

[Maple Plot]

From the plot, we see that g has a derivative everywhere except x = 0.

b)

> restart:

> f:= x -> piecewise(x < 1, x^2, 2*x - 1);

f := proc (x) options operator, arrow; piecewise(x ...

> D(f);

proc (x) options operator, arrow; piecewise(x <= 1,...

> df:= x -> piecewise(x < 1, 2*x, 2);

df := proc (x) options operator, arrow; piecewise(x...

>

> plot({f(x),df(x)}, x = -2..2, discont=true, color=[blue,brown]);

[Maple Plot]

From the plot we see that f has a derivative for all x.

c)

> restart:

> f:= x -> piecewise( x < -1, x^3, -1 <= x and x < 2, 1 + 2*x^2, 4*x + 1);

f := proc (x) options operator, arrow; piecewise(x ...

> D(f);

proc (x) options operator, arrow; piecewise(x < -1,...

> df:= x -> piecewise( x < -1, 3*x^2, -1 <= x and x < 2, 4*x, 4);

df := proc (x) options operator, arrow; piecewise(x...

> plot({f(x), df(x)}, x = -2..3, discont=true, color=[blue,brown]);

[Maple Plot]

From the plot we see that f has a derivative everywhere except x = -1,2.

3) The following function gives the position p at time t of a

particle moving along a coordinate line.

p = P(t) = t^4-4*t^2+4

a) Find the velocity and acceleration functions

b) On what intervals for t is the particle moving in the

positive direction? the negative direction?

a)

> restart:

> P:= t -> t^4 - 4*t^2 + 4;

P := proc (t) options operator, arrow; t^4-4*t^2+4 ...

> D(P);

proc (t) options operator, arrow; 4*t^3-8*t end pro...

> D(D(P));

proc (t) options operator, arrow; 12*t^2-8 end proc...

P'(t) = 4*t^3-8*t and P''(t) = 12*t^2-8 .

b)

> dP:= t -> 4*t^3 - 8*t;

dP := proc (t) options operator, arrow; 4*t^3-8*t e...

> plot({P(t),dP(t)}, t = 0..1, color=[brown,blue]);

[Maple Plot]

> plot({P(t),dP(t)}, t = 1..2, color=[brown,blue]);

[Maple Plot]

> plot({P(t),dP(t)}, t = 2..5, color=[brown,blue]);

[Maple Plot]

> solve(dP(t)=0, t);

0, sqrt(2), -sqrt(2)

> evalf(%);

0., 1.414213562, -1.414213562

Conclusion: the particle moves to the left for t in [0, sqrt(2)] and to the

right for sqrt(2) < t .