Diffusion equation with time-dependent boundary condition The bottom surface (located at $y=0$) of a semi-infinite, electrically conducting slab is subject to the slowly oscillating magnetic field $B = B_0 \cos(\omega t)$.
I am trying to find an expression for the magnetic field within the conductor as a function of $y$ and $t$ using the 1D diffusion equation:
$$\frac{\partial B}{\partial t} = \alpha \frac{\partial^2 B}{\partial y^2}$$
I know that the solution is given by:
$$B = B_0 \exp(-\frac{y}{\delta})\cos(\omega t -\frac{y}{\delta})$$
where $\delta = \sqrt{2 \alpha/\omega}$.
However, I can't quite figure out how to get there due to the time-dependent boundary condition.
I have tried separation of variables but with not much luck, since the solution I am looking for can't be expressed as a product $Y(y)T(t)$.
Could someone please tell me how to get to the solution?
 A: With slight changes in notation, we look for bounded solutions of $B_t = \alpha B_{yy}$ in the
half-plane $y>0$ subject to $B(t, y=0) = B_0\cos\omega_0 t$.
Suppose $B$ is a solution. Proceeding formally, assume
\begin{equation*}
 B(t, y) =
 \frac{1}{\pi}\int_0^\infty c(\omega, y)\cos\omega t\, d\omega + 
 \frac{1}{\pi}\int_0^\infty s(\omega, y)\sin\omega t\, d\omega
 \tag{1}
\end{equation*}
where
\begin{align*}
 c(\omega, y) &= \int_{-\infty}^\infty\, B(t, y)\cos\omega t\, dt, \\
 s(\omega, y) &= \int_{-\infty}^\infty\, B(t, y)\sin\omega t\, dt
\end{align*}
are the Fourier cosine and sine transforms of $B(t, y)$ with respect to $t$.
If $B$ satisfies $B_t = \alpha B_{yy}$ then substitution into (1) and rearrangement
shows these transforms must be related as
\begin{equation}
    \begin{aligned}
     -\omega c(\omega, y) &= \alpha s_{yy}(\omega, y), \\
    \omega s(\omega, y) &= \alpha c_{yy}(\omega, y).
    \end{aligned}
 \tag{2}
\end{equation}
Computing $c_{yyyy}$ and $s_{yyyy}$ we see that $c$ and $s$ satisfying this system
also satisfy $c_{yyyy} + (\omega/\alpha)^2 c = 0$ and $s_{yyyy} + (\omega/\alpha)^2 s = 0$.
Each has four linearly independent solutions
\begin{align*}
 & \exp(-\sqrt{\omega/2\alpha}y)\cos(\sqrt{\omega/2\alpha}y), \\
 & \exp(-\sqrt{\omega/2\alpha}y)\sin(\sqrt{\omega/2\alpha}y), \\
 & \exp(\sqrt{\omega/2\alpha}y)\cos(\sqrt{\omega/2\alpha}y), \\
 & \exp(\sqrt{\omega/2\alpha}y)\sin(\sqrt{\omega/2\alpha}y).
\end{align*}
The third and fourth forms are unbounded as $y\rightarrow\infty$ so we ignore them
and make use of the first and second only:
\begin{equation*}
 c(\omega, y) = \exp(-\sqrt{\omega/2\alpha}y)\biggl(c_1(\omega)\cos(\sqrt{\omega/2\alpha}y)
 + c_2(\omega)\sin(\sqrt{\omega/2\alpha}y)\biggr),
\end{equation*}
and similarly
\begin{equation*}
 s(\omega, y) = \exp(-\sqrt{\omega/2\alpha}y)\biggl(s_1(\omega)\cos(\sqrt{\omega/2\alpha}y)
 + s_2(\omega)\sin(\sqrt{\omega/2\alpha}y)\biggr).
\end{equation*}
Note that (2) implies a relation between $c_1, c_2$ and $s_1, s_2$,
specifically $s_1(\omega) = - c_2(\omega)$, $s_2(\omega) = c_1(\omega)$.
With these results, at $y = 0$ we have
\begin{align*}
 B(t, 0) &= \frac{1}{\pi}\int_0^\infty\, c(\omega, 0)\,\cos\omega t\, d\omega + \frac{1}{\pi}\int_0^\infty\, s(\omega, 0)\,\sin\omega t\, d\omega \\
 &= \frac{1}{\pi}\int_0^\infty\,c_1(\omega)\cos\omega t \, d\omega
 + \frac{1}{\pi}\int_0^\infty\,s_1(\omega)\sin\omega t \, d\omega.
\end{align*}
The condition $B(t, 0) = B_0\cos\omega_0 t$ suggests $c_1(\omega) = \pi B_0\delta(\omega - \omega_0)$
and $s_1(\omega) = 0$. Thus $c_2(\omega) = 0$, $s_2(\omega) = \pi B_0\delta(\omega - \omega_0)$. So
\begin{align*}
 c(\omega, y) &= \pi B_0\exp(-\sqrt{\omega/2\alpha}y)\cos(\sqrt{\omega/2\alpha}y)\delta(\omega - \omega_0) \\
 s(\omega, y) &= \pi B_0\exp(-\sqrt{\omega/2\alpha}y)\sin(\sqrt{\omega/2\alpha}y)\delta(\omega - \omega_0).
\end{align*}
Substitution into (1) and a bit of algebra gives
\begin{equation*}
 B(t, y) = B_0\exp(-\sqrt{\omega_0/2\alpha}y) \cos(\sqrt{\omega_0/2\alpha}y - \omega_0 t).
\end{equation*}
Addendum in hindsight
The above approach works for a large class of driving functions at $y = 0$, however, with $B_0\cos\omega_0 t$, things are far simpler. From a physics perspective you might argue the driver is $\omega_0$-periodic, so look for $\omega_0$-periodic solutions. That is:
$$B(t, y) = u(y)\cos\omega_0 t + v(y)\sin\omega_0 t.$$
Working with this form to begin with gets you to the same result with a lot less pain, and maybe a bit of physical-reasoning satisfaction.
