Using Fourier transforms to solve the boundary value problem Using Fourier transforms to solve the boundary value problem
$$ x =\begin{cases} u_{t}=4u_{xx}+\sin(t),  &  -\infty  \leq  x \leq \infty, t>0\\u(x,0)=e^{-x^2} \sin(x), & -\infty \leq x \leq \infty \end{cases}$$
I think I need to make the change $v=u-\cos(t)$. How to solve next?
 A: You can solve by Fourier transforming in $x$. Or, you can work as Fourier did: First separate variables, form sums of solutions, and then isolate coefficients. As you say, start by subtracting $\cos(t)$. Then separate variables
$$
             T'(t)X(x) = 4T(t)X''(x) \\
             \frac{1}{4}\frac{T'(t)}{T(t)}= \lambda = \frac{X''(x)}{X(x)}.
$$
The parameter $\lambda$ must be negative in order to have bounded solutions in $X$, and that also gives decay in time rather than the opposite. So $\lambda=-s^2$ where $s$ is real.
$$
           X''(x)+s^2 X(x) = 0,\;\;\; T'(t)=-4s^2T(t) \\
            X(x)=e^{isx},\;\; T(t) = e^{-4s^2 t}.
$$
Then sum these solutions using an integral,
$$
               u(x,t) = \int_{-\infty}^{\infty}c(s)e^{-4s^2t}e^{isx}ds,
$$
where $c(s)$ are the coefficients in the sum, analogous to discrete sums. The coefficient function is determined by the initial condition
$$
              e^{-x^2}\sin(x) = \int_{-\infty}^{\infty}c(s)e^{isx}ds.
$$
Multiplying by $e^{-isx}$ and integrating gives $c(s)$
$$
            \frac{1}{2\pi}\int_{-\infty}^{\infty}e^{-x^2}\sin(x)e^{-isx}dx=c(s).
$$
The $1/2\pi$ is the standard normalization factor, essentially inherited from the discrete case. If you know the Fourier transform of $e^{-x^2}$, then you can reduce to that case
\begin{align}
      c(s) &=  \frac{1}{2\pi}\int_{-\infty}^{\infty}e^{-x^2}\frac{e^{ix}-e^{-ix}}{2i}e^{-isx}dx \\
      & = \frac{1}{4\pi i}\int_{-\infty}^{\infty}e^{-x^2}e^{-i(s-1)x}dx-\frac{1}{4\pi i}\int_{-\infty}^{\infty}e^{-x^2}e^{-i(s+1)x}dx.
\end{align}
You can look up the Fourier transform $\hat{f}(s)$ of $e^{-x^2}$. This gives the unknown coefficient function
$$
     c(s)=\frac{1}{\sqrt{2\pi}i}\{\hat{f}(s-1)-\hat{f}(s+1)\}
$$
The solution is then
$$
       u(x,t) = \frac{1}{\sqrt{2\pi}i}\int_{-\infty}^{\infty}\{ \hat{f}(s-1)-\hat{f}(s+1)\}e^{-4s^2 t}e^{isx}ds.
$$
