Domain of $g(x)=\frac{\cos^2 x - \sin^2 x}{1-\tan x}$ in $\mathbb{R}$?

In $\mathbb{R}$ what is the domain of the function below?

$$g(x)=\dfrac{\cos^2 x - \sin^2 x}{1-\tan x}$$

I added two conditions:

$$D_g=\bigg\{x \in \mathbb{R}: 1-\tan x\neq 0 \wedge x\neq \dfrac{\pi}{2}+k\pi, k \in \mathbb{Z}\bigg\}$$

This gives me:

$$\mathbb{R}\backslash\left\{x:x=\frac{\pi}{4}+k\pi \wedge x=\frac{\pi}{2}+k\pi, k \in \mathbb{Z}\right\}$$

The book solution is only:

$$\mathbb{R}\backslash\left\{x:x=\frac{\pi}{4}+k\pi, k \in \mathbb{Z}\right\}$$

Am I missing something or is the solution in the book wrong? I don't see how $\dfrac{\pi}{2}$ is in the domain...

• You can define a continuation of the function at $\frac\pi2+k\pi$. – Bernard Nov 9 '17 at 20:41
• your answer is basically correct (although you have to turn the "and" into an "or" in your final form)--the book has a mistake. – Leonard Blackburn Nov 9 '17 at 20:45
• yes, that's right @LeonardBlackburn I made a mistake writing that. – Concept7 Nov 9 '17 at 20:48
• @Bernard That doesn't mean those points are in the domain – user223391 Nov 9 '17 at 20:48
• @ZacharySelk; Strictly speaking, no, of course. I tried to explain the answer in the book. The other explanation is there's an error. It depends very much on the book phrasing in the book. – Bernard Nov 9 '17 at 20:59

You are right. The function is undefined at $x=\frac\pi2+k\pi$, because $\tan(x)$ is undefined there. The function is also undefined at $x=\frac\pi4+\ell\pi$, because that is where the denominator equals zero (i.e. $1=\tan(x)$).
You can write this as $$\mathbb R\setminus\left\{x: x=\frac\pi2+k\pi \,\vee\, x=\frac\pi4+\ell\pi,\, k\in\mathbb Z,\,\ell\in\mathbb Z\right\}\\ \text{(notice the \vee and notice that you need to use two different parameters k and \ell.)}$$
All points excluded $x=\pi/4+k\pi;\;x=\pi/2+h\pi$ can be easily reincluded simplifying the function in $$f(x)=\frac{(\cos x+\sin x)(\cos x-\sin x)}{\frac{\cos x-\sin x}{\cos x}}=\cos x (\sin x+\cos x)$$ Indeed plotting the result is exactly the same. It's like the function $g(x)=\frac{x^2-4}{x-2}$ where the discontinuity in $x=2$ can be removed and the function becomes $g(x)=x+2$
$$...$$ 