calculus question attempt find the maximum value of the function $$y = 15 \sin x -8 \cos x $$
attempt at  a solution: 
 deriving: $y' = 15\cos x +8\sin x 
$  equating to zero and doubling by $ 1/\cos x$  (Im not sure this is allowed since if $x$ is $\pi/2 $ we might find ourselves in a bit of a trouble)  : $$0 = 15 +8\tan x $$
a few steps forward; $x=-0.344\pi$. by checking near by points we can determine its a maximum...
so final solution is $(-0.344\pi,0) max$. 
I didn't get the answers right though, so any help would be appreciated. 
 A: $$y' = 15\cos x +8\sin x = 0 \iff 8\sin x = -15\cos x \implies \frac{\sin x}{\cos x} = -\frac {15}{8}, $$ $$\iff \tan x = -\frac{15}{8},\;\text{provided } \;\cos x \neq 0$$
Since $\cos x = 0$ does not solve the equation, we can divide by $\cos x$ without problems.
Now, determine when $\tan x = -\frac{15}{8}$, by using the arctan function on each side of the equation. $$x = \arctan\left(-\frac {15}{8}\right)$$ and then determine all other solutions. The desired solution will be a maximum when it lies in the second quadrant, so that $\sin x > 0$, $\cos x < 0$.  This will yield the greatest value of $y$, when substituted into the original equation.
A: Your equation is
$$y = 15 \sin x -8 \cos x
\\=17\{ \frac{15}{17} \sin x -\frac{8}{17} \cos x\}
\\=17\{  \sin x \cos\theta- \cos x\sin\theta\}
\\=17\sin (x-\theta)$$Then the maximum value is 17
A: Your approach is essentially correct, except that in order to maximize the function you want $\sin x$ to be positive and $\cos x$ to be negative. So you want a solution for $\tan x = -15/8$ in the range $(\pi/2, \pi)$.
