General values of $\theta$ for which $(\sin\theta)x^2+(2\cos\theta)x+\frac{\cos\theta+\sin\theta}{2}$ is the square of a linear function. Find the general values of $\theta$ for which the quadratic function $(\sin\theta)x^2+(2\cos\theta)x+\frac{\cos\theta+\sin\theta}{2}$ is the square of a linear function.

As the quadratic function is the square of a linear function,so its discriminant should be zero.
$(2\cos\theta)^2=4(\sin\theta)\frac{\cos\theta+\sin\theta}{2}$
$2\cos^2\theta=\sin^2\theta+\sin\theta\cos\theta$
$(\cos^2\theta-\sin^2\theta)=(\sin\theta\cos\theta-\cos^2\theta)$
$(\cos\theta-\sin\theta)(\cos\theta+\sin\theta)=(-\cos\theta)(\cos\theta-\sin\theta)$
Either $\cos\theta-\sin\theta=0$ or $\tan\theta=-2$
So i found general solution as $n\pi+\frac{\pi}{4}$ or $n\pi-\arctan(2),$ where $n$ is an integer. But the answer given in the book is $2n\pi+\frac{\pi}{4}$ or $(2n+1)\pi-\arctan(2)$,where $n$ is an integer.
I dont know where i am wrong.

Since it is the square of a linear function, it has to be positive. So the first coefficient $\sin \theta$ has to be positive. This gives the criteria that $\theta$ is in the first or second quadrant. Hence the answer $2n\pi+\cdots$
