#f(x) = xsinx-cos^2x#
Apply product rule, chain rule and standard derivatives.
#f'(x) = xcosx+sinx- 2cosx*(-sinx)#
#= xcosx+sinx+2sinxcosx#
#= xcosx+sinx+sin(2x)#
The slope of #f(x)# at #x=pi/8# is #f'(pi/8)#
#f'(pi/8) = pi/8*cos(pi/8) +sin(pi/8) + sin(pi/4)#
#approx 1.542597# (Calculator)
The slope of a tangent (#m_1#) #xx# slope of a normal (#m_2#) at any point on a curve is given by: #m_1*m_2 =-1#
#:.# Slope of the normal to #f(x)# at #x=pi/8 approx -1/1.542597#
#approx -0.688422#
The equation of a straight line of slope #m# passing through the point #(x_1,y_1)# is given by:
#(y-y_1) = m(x-x_1)#
In this example, our normal will have the equation:
#y-f(pi/8) approx -0.688422 (x-pi/8)#
#y- (-0.703274) approx -0.688422 (x- 0.392699)# (Calculator)
#y+0703274 approx -0.688422x+0.270343#
#y approx -0.688422x-0.432931#
#y =-0.69x-0.43# [To 2D]
We can see #f(x)# and the normal at #x=pi/8# on the graphic below.