I'm trying to approximate $\coth(x)$ around $x = 0$, up to say, third order in $x$. Now obviously a simple taylor expansion doesn't work, as it diverges around $x = 0$. I'm not quite sure how to proceed from here. I had a look at Series expansion of $\coth x$ using the Fourier transform
but this is a bit technical for my purposes, and I also don't need the entire series. Is there an easy way of getting some terms, or do I really have to solve for the entire series? And is there a simpler way to do so than with the Fourier transform?
The series representation must reflect that divergence at $x=0$. Thus,
$$\begin{align}\coth{x} &= \frac{1+\frac{x^2}{2!}+\frac{x^4}{4!}+O(x^6)}{\frac{x}{1!}+\frac{x^3}{3!}+\frac{x^5}{5!}+O(x^7)} \\ &= \frac1{x} \frac{1+\frac{x^2}{2!}+\frac{x^4}{4!}+O(x^6)}{1+\frac{x^2}{3!}+\frac{x^4}{5!}+O(x^6)}\\&= \frac1{x} \left (1+\frac{x^2}{2!}+\frac{x^4}{4!}+O(x^6) \right ) \left [1 - \left (\frac{x^2}{3!}+\frac{x^4}{5!}+O(x^6) \right )+\left (\frac{x^2}{3!}+O(x^4) \right )^2+O(x^6) \right ] \\ &= \frac1{x} \left [1+\left (\frac1{2!}-\frac1{3!} \right ) x^2 +\left (\frac1{(3!)^2} + \frac1{4!}-\frac1{5!} - \frac1{2! 3!}\right ) x^4+O(x^6) \right ]\\ &= \frac1{x}+\frac{x}{3} - \frac{x^3}{45}+O(x^5) \end{align}$$
Note that the divergence at $x=0$ is reflected in the $1/x$ term.