Inverse Fourier transform of a shifted cos
The problem is that when I try using the general formula for inverse Fourier transform I get stuck by the infinities.

The reason for this is that a cosine function has infinite energy, and therefore its Fourier transform is not a well defined function.  Instead, one usually uses the Fourier series for periodic functions, since that integral will converge.
However, by convention, you can define the FT of cosine using the delta &quot;function&quot;.  See:
https://dsp.stackexchange.com/questions/11554/deriving-the-fourier-transform-of-cosine-and-sine