The question is as follows:
Let $h$ be the function such that $h(x) = \tan\left(\sqrt{\dfrac{1}{x+2}}\right)$. (a) Find the domain of $h$ and (b) find the values of $x$ such that $h(x)=1$.
For part a, I notice that $1/(x+2)$ is the argument of a square root function. My class defaults to functions having a domain and codomain of real numbers, so it follows that $1/(x+2)$ must be nonnegative. By interval testing, I determine that $x \in (-2,\infty)$.
I also notice that tangent has undefined values, i.e. the undefined values of $\tan(x)$ are $x \in \pi/2 + \pi n, n \in \mathbb{Z}$. So this must also be considered in the domain: $$\sqrt{\frac{1}{x+2}} \ne \frac{\pi}{2} + \pi n, n \in \mathbb{Z}$$
If I square both sides and then isolate $x$, it results in $$ x \ne \dfrac{1}{\left(\frac{\pi}{2} + \pi n\right)^2} -2,\ n\in\mathbb{Z}$$
So the domain of $h$ is $$\left\{x \mid x\in\mathbb{R}, x\in (-2,\infty), x \ne \frac{1}{(\pi/2+\pi n)^2}-2, n \in\mathbb{Z} \right\} $$ Is this answer and set-builder notation okay?
For part b, solving $ \tan\left(\sqrt{\frac{1}{x+2}}\right) = 1$ lead me to $$ \sqrt{\frac{1}{x+2}} = \frac{\pi}{4} + \pi n,\ n\in\mathbb{Z}$$ and squaring both sides and solving for $x$ gives $$ x = \frac{1}{\left(\frac{\pi}{4} + \pi n\right)^2} - 2,\ n\in\mathbb{Z}$$
This seems to hold for $n\ge 0$, but for negative $n$, this results in a wrong result (leading to $h$ giving values of $-1$ instead of $1$). How could I have predicted an extra restriction for $n$?
$\displaystyle\sqrt{\frac{1}{x+2}} = \frac{\pi}{4} + \pi n,\ n\in\mathbb{N}$ because you should only consider natural number values of n (including 0), otherwise you are equating a square root to a negative number, and you're only looking at real domains/codomains.