Tangent Lines

Example: Find the equation of the tangent line to the graph of y=sin[x] at the point {(π/6), (1/2)}.

Solution: The slope of the tangent line at the point {(π/6), (1/2)} is y'[(π/6)]=Cos[(π/6)] = ((Sqrt[3])/2). The point-slope formula for a line gives the equations of the tangent line, y = (1/2) + (1/2) (Sqrt[3]) (x - (π/6)). Here is the graph of y=Sin[x] plotted together with the tangent line.

Plot[{Sin[x], (1/2) + (1/2) (Sqrt[3]) (x - (π/6))}, {x, 
        -(π/2), (π/2)}]

Example: Show that  Sin[x] is approximately equal to x for x near  0.

Solution: The tangent line approximation theorem says that f[x] is approximately equal to f[a]+f'[a] (x - a) for x near a. On our case f[x]=Sin[x], and a=0, so Sin[x] is approximately f[0] + f'[0](x-0) = 0 + 1(x-0) = x. Here is a table of values of x and Sin[x] for x near 0 to compare.

MatrixForm[N[Table[{x, Sin[x]}, {x, 0,   .1,  0.01}]]]

Plot[{x, Sin[x]}, {x, -(π/2), (π/2)}]

Example: Find the equation of the line tangent  to the curve defined by
    x y + Cos[x - (y^2)] == 9
at the point {4,2}.

Solution: Treating  y[x] as an implicitly defined function of x and taking the derivative of the equation of the curve implicitly gives

D[x y[x] + Cos[x - y[x]^2] == 9,  x]

Solve[%, y'[x]]

Substuting  x->4, y->2 gives the slope at this point:

%  /.  {x -> 4,  y[x] -> 2}

The equation of the tangent line is then y = 2 - (1/2)(x-4) = 4 - x/2. We can plot the curve defined by the equation using ContourPlot[] with one contour, 9 (a contour has  the form f[x]==c and we may choose  the values  of c).

curve = 
      ContourPlot[x y + Cos[x - (y^2)], {x, 2, 6}, {y, 0, 4}, 
        Contours -> {9}, ContourShading -> False, 
        PlotPoints -> 30]

tline = Plot[4 - (x/2), {x, 2, 6}]

Show[{curve, tline}]