Help to find the domain to this function $$
\sqrt{\log_\frac{1}{2}\left(\arctan\left(\frac{x-\pi}{x-4}\right)\right)}
$$
Please, could someone show me the steps to find the domain of this function?
It's the sixth time that I try to solve it, and I'm going to burn everything...
 A: I assume that you are talking about the so-called "natural domain" of a real valued function of real variable (a common concept in Calculus, at least in the U.S.): given a formula, such as the above, and no words about its domain, we assume the domain is to be taken to be a subset of the real numbers, and that this subset should be "as large as possible". That is, we want the know all real numbers for which the expression makes sense and yields a real number.
So, let's analyze the expression step by step, just as you would if you were trying to evaluate it. 


*

*First, given an $x$, you would compute both $x-\pi$ and $x-4$. No problems there, that can be done with any real number $x$.

*Then you would compute $\frac{x-\pi}{x-4}$. In order to be able to do this, you need $x-4\neq 0$. So we are going to have to exclude $x=4$. That is, the domain so far is "all $x\neq 4$".

*Then we would compute $\arctan\left(\frac{x-\pi}{x-4}\right)$. Since the domain of the arctangent is "all real numbers", this can be done with any $x$ for which the fraction makes sense. We don't need to exclude any new values of $x$.

*Then we would try to compute the logarithm (base $\frac{1}{2}$) of this number. In order to be able to compute the logarithm, we need the argument to be positive. So we are going to need
$$\arctan\left(\frac{x-\pi}{x-4}\right)\gt 0.$$
When is the arctangent positive? When the argument is positive. So we need
$$\frac{x-\pi}{x-4}\gt 0.$$
When is a fraction positive? When both numerator and denominator are positive, or when they are both negative. 
So we need either $x-\pi\gt 0$ and $x-4\gt 0$ (this happens when $x\gt 4$); or $x-\pi\lt 0$ and $x-4\lt 0$ (this happens when $x\lt \pi$). So we now need to restrict our $x$s to $(-\infty,\pi)\cup(4,\infty)$. (Note that this also maintains the exclusion of $4$).

*Finally, we need to take the square root of the answer. That means that the logarithm must be nonnegative. When is $\log_{\frac{1}{2}}(a)\geq 0$? When $0\lt a \leq 1$ (taking exponentials with base $\frac{1}{2}$ flips the inequality, because $(\frac{1}{2})^x$ is decreasing). So we actually need
$$0\lt \arctan\left(\frac{x-\pi}{x-4}\right)\leq 1.$$
When is $0\lt \arctan(a)\leq 1$? When $0\lt a \lt \frac{\pi}{4}$ (thanks to Jonas Meyer for the heads up!). When $\tan(0)\lt a \leq \tan(1)$. So we need
$$0 \lt \frac{x-\pi}{x-4}\leq \tan(1).$$
Since $\tan(1)\gt 0$ This happens if either
$$0\lt (x-\pi) \lt \tan(1)(x-4)$$
or
$$\tan(1)(x-4)\lt (x-\pi)\lt 0.$$
So check the inequalities; then remember that $x$ must be greater than $4$ for both $x-\pi$ and $x-4$ to be positive; or less than $\pi$ for both to be negative. 
A: Here is a detailed outline. There is an obvious problem at $x=4$. But things also go bad if $\frac{x-\pi}{x-4}\le 0$, for then the $\arctan$ is $\le 0$, so the log does not exist.  As a first step to finding the bad places, solve the inequality
$$\frac{x-\pi}{x-4} \le 0.$$
The only places where this can change sign are $x=\pi$ and $x=4$.  Evaluate $\frac{x-\pi}{x-4}$ at three points, one less than $\pi$, one between $\pi$ and $4$, and one bigger than $\pi$.
Now we need to deal with the square root part.  What is inside the square root must be $\ge 0$.  The $1/2$ as a base for the logarithm is a nuisance. It may make things easier to note that $\log_{1/2} u =-\log_2 u$. So we want the log to the base $2$ to be $\le 0$.  That means that we want the $\arctan$ to be positive but $\le 1$.  So we want $0<\frac{x-\pi}{x-4}\le \tan(1)$.   
