<s>[INST] When solving $\tan(3x) = \cot(4x)$, how to formulate the answer? when I solve the following equation:
$\tan(3x) = \cot(4x)$
I get the following solution:
$x = \frac{\pi}{14} + \frac{\pi n}{7}, n \in \mathbb{Z}$
But as x must be $\neq \frac{\pi}{6} + \frac{\pi k}{3}$ and $\neq \frac{\pi k}{4}$, with $k \in \mathbb{Z}$, there are values for n for which $x = \frac{\pi}{14} + \frac{\pi n}{7}, n \in \mathbb{Z}$ gives wrong solutions, e.g.:
for
$n = 3, x = \frac{\pi}{14} + \frac{3\pi}{7} = \frac{7\pi}{14} = \frac{\pi}{2}$
Which is not a solution because $\tan(3(\frac{\pi}{2}))$ is not defined (cosine is 0)
So how do I merge the solution $x = \frac{\pi}{14} + \frac{\pi n}{7}, n \in \mathbb{Z}$ with the domain? What is the algorithm?
Or, can I just write:
$x \in \{\frac{\pi}{14} + \frac{\pi n}{7}: n \in \mathbb{Z}\} \setminus \{\frac{\pi}{6} + \frac{\pi k}{3} : k \in \mathbb{Z} \} \setminus \{\frac{\pi k}{4} :k \in \mathbb{Z}\}$
Which is a bit ugly, I think.
What is the right way to do that?
Thanks for the attention!
 [/INST] 
You get $\cos(7x)=0$ and $\cos(3x)\sin(4x) \ne 0$.
As you've already figured out
$\cos(7x) = 0 \implies x = \dfrac{2j+1}{14}\pi \quad (j \in \mathbb Z)$
$\cos(3x) = 0 \implies x = \dfrac{2k+1}{6}\pi \quad (k \in \mathbb Z)$
$\sin(4x) = 0 \implies x = \dfrac{\ell}{4} \pi \quad (\ell \in \mathbb Z)$
We look for coincidence of points
\begin{align}
   \dfrac{2j+1}{14}\pi &= \dfrac{2k+1}{6}\pi \\
   6j+3 &= 14k+7 \\
   3j - 7k &= 2 \\
   \hline
   j &= 7n + 3\\
   k &= 3n + 1\\
\hline
   \theta &\ne \dfrac{2n+1}{2}\pi
\end{align}
\begin{align}
   \dfrac{2j+1}{14}\pi &= \dfrac{\ell}{4} \pi \\
   4j+2 &= 7 \ell \\
   7 \ell - 4j &= 2 \\
   \hline
   j    &= 7n + 3\\
   \ell &= 4n + 2\\
\hline
   \theta &\ne \dfrac{2n+1}{2}\pi
\end{align}
So we have to require $j \ne 7n + 3$, which we can write as 
$j \not \equiv 3 \pmod 7$. In summary
$x = \dfrac{2j+1}{14}\pi\;$ where $\; j \not \equiv 3 \pmod 7$
</s>