# Line equation of a tangent line of $f(x) = x\cos(3x)$

I'm new here so maybe I'll need some help with formatting with MathJax, as well.

So question asks for tangent line of $f(x) = x\cos(3x), x= \pi$

So:

$$f(x) = x.\cos(3x)$$ $$f'(x) = -x.\sin(3x)+\cos(3x).3$$

$$f(\pi) = -\pi$$ $$f'(\pi) = -3$$

$$y = -3x - 2\pi$$

The answer of the book: $$y = -x$$

Considering: $$y = ax + b$$ $$y = f(x)$$ $$a = f'(x)$$ What am I missing?

• you miscalculated the derivative. – mesel May 17 '14 at 17:51

You made a couple of mistakes in using the product rule.

$$f(x) = x\cos(3x) \implies f'(x) = x \cdot \frac{d}{dx}(\cos(3x)) + \dfrac{d}{dx}(x)\cdot \cos(3x)$$

$$= x\cdot (-\sin (3x))\cdot 3 + \cos 3x$$

$$= -3x\sin(3x)+ \cos (3x)$$

Now substitute $x = \pi$ into $f'(x)$ to obtain slope at that point: $-3\pi\cdot \sin(3\pi) + \cos (3\pi) = -1$

So the slope of the desired line needs to be $-1$.

Now, given $x_0 = \pi$, $y_0 = f(x_0) = f(\pi) = -\pi$.

So we have the point on the tangent line (the point of tangency): $(\pi, -\pi)$. That gives you the line \begin{align} y - y_0 = -1(x - x_0) &\iff y - (-\pi) = -1(x - \pi)\\ \\ & \iff y + \pi = -x + \pi \\ \\ & \iff y = -x\end{align}

• Your answer showed me something that I was repeating question after question and haven't given attention. Derivative was wrong and how to find line equation was misunderstood. Thank you a lot. – Fabiano Araujo May 17 '14 at 18:15
• You're welcome, Fabiano! – amWhy May 17 '14 at 18:15

HINT:

$$f'(x)=\frac{d(x\cos3x)}{dx}=\frac{dx}{dx}\cdot\cos3x+x\cdot\frac{d(\cos3x)}{dx}=\cos3x-3x\sin3x$$