In the book "Calculus of several variables" by Sege Lang in page 144 the author proposes the following problema:
Find the extreme values of the function $$f(x,y)=\cos^2x + \cos^2y$$ subject to the constraint $x - y = \pi/4$ and $0\leq x\leq \pi$.
I have some difficulty in solving this problema. I tried to substitute $y$ by $x-\frac{\pi}{4}$ and get a function $g$ of a single variable: $$g(x)=\cos^2x+\frac{1}{2}(\cos x+\sin x)^2$$
Now to find the extreme values of the function g I'm trying to solve the equation:
$$\frac{d g}{dx}=-2\cos x\sin x+(\cos x+\sin x)(\cos x-\sin x)=-2\cos x\sin x+ \cos^2x-\sin^2x=0$$ I can not find the solutions of this last euquation. Anyone have an idea?