Using the necessary and sufficient conditions compute all minima and maxima of a given function 
Using the necessary and sufficient conditions compute all minima and maxima of 
  $$f(x,y) = x^2 + 8x\cos(y) − 2x + 10\cos(y) − 8\cos^2(y) + 8\cos^3(y)$$ 
  for $(x,y) \in \mathbb{R}^2$.

My attempt:
Take the partial derivatives on both variables w.r.t $\,x$ and $y$, this gives $$2x+8\cos(y)-2$$ 
and 
$$\sin(y)(-8x-10+16\cos(y)-24\cos^2(y)),$$ 
respectively.
Equating each of these two equations to $0$, we get either $\sin(y)=0$ giving $y=2k\pi$ and $x=-3$,  or $y=2k\pi+\pi$ and $x=5$ for $k\in\mathbb{Z}$.
My problem is when $(-8x-10+16\cos y-24\cos^2y)=0,$ what are the values of $x$ and $y$?

If $2x+8\cos(y)−2=0$ then 
$$\cos(y)=\frac{1-x}{4}.$$
Moreover $-8x-10+16\cos(y)-24\cos^2(y)=0$ implies
$$4x=-5+8\cos(y)-12\cos^2(y)=-5+2(1-x)-(3/4)(1-x)^2$$
that is
$$x^2+6x+5=0$$
which has two real solutions: $x=-1$ and $x=-5$.
Hence 
1) if $x=-1$ then $\cos(y)=1/2$ and we have further critical points: 
$$(-1,\pi/3+2k\pi),\quad (-1,-\pi/3+2k\pi)\quad\text{for  $k\in\mathbb{Z}$.}$$
2) If $x=-5$ then $\cos(y)=3/2$: no real solutions.
