Calculus, 10th Edition (Anton)

The tangent line at $x=\pi$ is $y=-x.$
The equation for the tangent line at $x_0$ is: $y-f(x_0)=f'(x_0)(x-x_0)$ Here $x_0=\pi$ and $f(x)=y=x\cos3x$. $$f'(x)=(x\cos3x)'=x'\cos3x+x(\cos 3x)'=1\cdot\cos3x+x(-\sin 3x)(3x)'=\cos3x-3x\sin 3x$$ Now for $x_0=\pi$ we have: $$f(\pi)=\pi\cos3\pi=-\pi, f'(\pi)=\cos3\pi-3\pi\sin3\pi=-1-3\pi\cdot0=-1$$ The equation for the tangent line at $x=\pi$ is: $$y-(-\pi)=-1\cdot(x-\pi)\Rightarrow y=-x$$