Solving the PDE $\frac{\partial T}{\partial t} = K\frac{\partial^{2} T}{\partial x^{2}}$ I am trying to find solutions to the following PDE:

$$\frac{\partial T}{\partial t} = K\frac{\partial^{2} T}{\partial x^{2}},$$ With boundary condition: $T(0,t)=T_{0}\cos(\omega t)$, where $\omega = \frac{2K}{a^{2}}$.

I am trying to solve this by separation of variables into $T(x,t) = X(x)F(t)$ so we have: 
$$X(x)\frac{\partial F}{\partial t}=KF(t)\frac{\partial^{2} X}{\partial x^{2}}$$
Thus we have the following two conditions:
$$\frac{\partial F}{\partial t}=-\lambda K F(t) \land \frac{\partial ^{2} X}{\partial x^{2}}=-\lambda X(x)$$
Solving these (and taking into account that $\lambda$ can be arbitrary), we have:
$$F(t)=\sum_{\lambda} \alpha_{\lambda} \exp(-\lambda K t) \land X(x)=\sum_{\lambda}\left(A_{\lambda}\cos(\sqrt{\lambda}x)+B_{\lambda}\sin(\sqrt{\lambda}x)\right)$$
We have boundary condition:
$$T(0,t)=T_{0}\cos(\omega t)$$
However, I am having trouble now computing the coefficients $\alpha_{\lambda}$, $A_{\lambda}$ and $B_{\lambda}$.

The question in it's full form is given by:

The temperature $T$ in a one-dimensional bar whose sides are perfectly insulated obeys the heat flow equation: $$\frac{\partial T(x,t)}{\partial t}=K\frac{\partial^{2}T(x,t)}{\partial x^{2}}$$ where $K$ is a constant. The bar extends from $x=0$ to $x=\infty$. The temperature at the end $x=0$ oscillates in time according to $T(x=0,t)=T_{0}\cos(\omega t)$. By looking for solutions that are separated in $x$ and $t$ ($T = X(x)F(t)$) find the solution for all $x \geq 0$ and $t$, which matches the boundary condition at $x=0$. Sketch $T$ versus $x$ for $\omega t = \pi/2$, given that $\frac{\omega}{2K}=\frac{1}{a^{2}}$.

 A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,{\rm Li}_{#1}}
 \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
Look for solutions of the form
$\ds{\,{\rm T}\pars{x,t}
     \equiv \bracks{%
     \,{\rm s}\pars{x}\sin\pars{\omega t} + \,{\rm c}\pars{x}\cos\pars{\omega t}}}$
which satisfies
$\ds{\partiald{\,{\rm T}\pars{x,t}}{t} = K\,\partiald[2]{\,{\rm T}\pars{x,t}}{x}}$
with $\ds{\,{\rm s}\pars{0} = 0}$ and $\ds{\,{\rm c}\pars{0} = T_{0}}$.

\begin{align}&\omega\,{\rm s}\pars{x}\cos\pars{\omega t}
-\omega\,{\rm c}\pars{x}\sin\pars{\omega t}
=K\,{\rm s}''\pars{x}\sin\pars{\omega t} + K\,{\rm c}''\pars{x}\cos\pars{\omega t}
\\[5mm]&
\imp\quad\,{\rm c}''\pars{x} - {\omega \over K}\,{\rm s}\pars{x} = 0\,,\qquad
\,{\rm s}''\pars{x} + {\omega \over K}\,{\rm c}\pars{x} = 0
\\[5mm]&\imp\quad\bracks{\,{\rm c}''\pars{x} + \ic\,{\rm s}''\pars{x}}
+\ic\,{\omega \over K}\bracks{\,{\rm c}\pars{x} + \ic\,{\rm s}\pars{x}}=0
\end{align}


Solutions are linear combinations of

\begin{align}&\dsc{\exp\pars{\pm\root{\ic\,{\verts{w} \over K}}x}}
=\exp\pars{\pm\pars{1 + \ic}\root{{\verts{w} \over 2K}}x}
\\[5mm]&=\exp\pars{\pm\,{x \over a}}
\exp\pars{\pm\ic\,{x \over a}}
\end{align}
Since the equation is the second order in $\ds{x}$, it will require another condition. Lets require, $\dsc{\mbox{for example}}$, that
$\ds{\lim_{x\ \to\ \infty}\,{\rm T}\pars{x,t} = 0}$. In that case the solution becomes:
$$
\,{\rm c}\pars{x} + \ic\,{\rm s}\pars{x}=T_{0}\expo{-x/a}\cos\pars{x \over a}
\quad\imp\quad\left\{\begin{array}{rcl}
\,{\rm c}\pars{x} & = & T_{0}\expo{-x/a}\cos\pars{x \over a}
\\[2mm]
\,{\rm s}\pars{x} & = & 0
\end{array}\right.
$$

$$
\color{#66f}{\large\,{\rm T}\pars{x,t}}
=\color{#66f}{\large T_{0}\expo{-x/a}\cos\pars{x \over a}\cos\pars{\omega t}}
$$
