I would like to know what the graph of $\tan(f(x))=\frac{x}{1-x^2}$ given that $f(0)=\pi$ looks like.
My attemt
$\tan(f(x))=\tan(f(x)+k\pi)$ for some intiger $k$. It follows that $f(x)=\arctan{\frac{x}{1-x^2}}-k\pi$ . Using the initial condition we find$k=-1$ and thus $f(x)=\arctan{\frac{x}{1-x^2}}+\pi$ when I graphed this and checked with desmos this does not look like $\tan(f(x))=\tan(f(x)+k\pi)$ as the limits for $x\to \infty$ differ. In my case as $x\to\infty$, $f(x)$ tends to $\pi$ but in the solution it tends to $2\pi$.
My Graph
Answer graph
Could someone explain to me what I have done wrong?
Edit I should add that we were told that we may assume that $f(x)$ is continues at +/- 1. Maybe this was they way of telling is that we need to make it look continius?


It is true, that for any $x\in \mathbb{R}\setminus \{-1,1\}$ there must exist a $k\in \mathbb{Z}$, such that $f(x) = \arctan(\frac{x}{1-x^2})+k\pi$, but we cannot simply assume that the same $k$ holds for all $x$.
If we have further information, such as the information that $f$ is continuous on $(-\infty, -1)\cup (-1,1)\cup (1,\infty)$, then we must have a fixed constant on each interval, meaning that $$f(x) = \begin{cases} \arctan(\frac{x}{1-x^2}) + k_1\pi &,\text{for } x\in (-\infty,-1) \\ \arctan(\frac{x}{1-x^2}) + k_2\pi &,\text{for } x\in (-1,1) \\ \arctan(\frac{x}{1-x^2}) + k_3\pi &,\text{for } x\in (1,\infty) \end{cases}$$ And as you have already mentioned the initial condition $f(0)=\pi$ implies that $k_2=1$.
Now if we want to extend $f$ to a function on the entire real line in a way, such that it is continuous, then we must have $$f(-1) = \lim_{x\:\uparrow \: -1}\arctan(\frac{x}{1-x^2}) +k_1 \pi = \lim_{x\:\downarrow \:-1} \arctan(\frac{x}{1-x^2}) + \pi$$ and $$f(1) = \lim_{x\:\uparrow \: 1}\arctan(\frac{x}{1-x^2}) + \pi = \lim_{x\:\downarrow \: 1} \arctan(\frac{x}{1-x^2}) + k_3\pi$$ where $\lim_{x \: \uparrow a}$ and $\lim_{x \: \downarrow \: a}$ denotes left and right limits respectively. Using that, $\lim_{y\rightarrow -\infty}\arctan(y) = -\pi/2$ and $\lim_{y\rightarrow \infty} \arctan(y) = \pi/2$ we find that $f(-1) = \frac12 \pi$ and $f(1) = \frac{3}{2} \pi$ and therefore $k_1 = 0$ and $k_3 = 2$, thus finally we get that
$$f(x) = \begin{cases} \arctan(\frac{x}{1-x^2}) &,\text{for } x\in (-\infty,-1) \\ \frac12 \pi &,\text{for } x=-1 \\ \arctan(\frac{x}{1-x^2}) + \pi &,\text{for } x\in (-1,1) \\ \frac32 \pi &,\text{for } x=1 \\ \arctan(\frac{x}{1-x^2}) + 2\pi &,\text{for } x\in (1,\infty) \end{cases}$$