Questions--Heat equation with $x>0,t>0$ I have the following problem:
$$u_t=u_{xx}, x>0, t>0$$
$$u(x=0,t)=0 , t>0$$
$$u(x,t=0)=f(x), x>0$$
The solution of the problem is: 
$$u(x,t)=\int_0^{+\infty} a(k) \sin(kx) e^{-k^2t} dk$$
$$u(x,0)=f(x)=\int_0^{+\infty} a(k) \sin(kx) dk$$
$$\sin(k'x) f(x)= \sin(k'x) \int_0^{+\infty} a(k) \sin(kx) dk \Rightarrow \int_{0}^{\infty}\sin(k'x) f(x) dx =  \int_0^{+\infty} a(k) \sin(kx) \sin(k'x) dk dx$$
We know the integral:
$$\int_{-\infty}^{+\infty} e^{-i(k-k')x}dx= 2 \pi \delta(k-k')$$
$$e^{-ikx} e^{ik'x}=\cos(kx) \cos(k'x)+\sin(kx) \sin(k'x)+ i(\cos(kx) \sin(k'x)-sin(kx) \cos(k'x)) $$
Why do we know that $e^{-ikx} e^{ik'x}=$ is real,so  $\cos(kx) \sin(k'x)-sin(kx) \cos(k'x)=0$ ?
Also, why $\int_{-\infty}^{+\infty} (\cos(kx) \cos(k'x)+\sin(kx) \sin(k'x))dx=2 \int_{\infty}^{+\infty} \sin(kx) \sin(k'x) dx$ ?
 A: The simplest way to solve the initial boundary value problem 
$$
\begin{cases}
u_t-u_{xx}=0,\;\;x>0,\;\,t>0,\\
u|_{x=0}=0,\quad t\geqslant 0,\\
u|_{t=0}=f(x),\quad x\geqslant 0,
\end{cases}\tag{1}
$$
is to take an odd extension of the initial data $f$ from the half-axis $\mathbb{R}_{+}$
to the whole $\mathbb{R}$, i.e.,
$$
\widetilde{f}(x)=
\begin{cases}
f(x),\quad x\geqslant 0,\\
-f(-x),\;\, x<0,
\end{cases}\tag{2}
$$
and solve the initial value problem
$$
\begin{cases}
u_t-u_{xx}=0,\;\,t>0,\\
u|_{t=0}=\widetilde{f}(x),\quad x\geqslant 0,
\end{cases}
$$
using the well-known Poisson formula
$$
u(x,t)=\frac{1}{\sqrt{4\pi t}}\int\limits_{-\infty}^{\infty}\widetilde{f}(y)
e^{-\frac{(x-y)^2}{4t}}dy
$$
whence, due to $(2)$, follows the required representation of solution $$
u(x,t)=\frac{1}{\sqrt{4\pi t}}\biggl(\int\limits_{0}^{\infty}+\int\limits_{-\infty}^{0}\biggr)=\frac{1}{\sqrt{4\pi t}}\int\limits_{0}^{\infty}f(y)\Bigl(e^{-\frac{(x-y)^2}{4t}}-e^{-\frac{(x+y)^2}{4t}}\Bigr)dy\tag{3}
$$
the initial boundary value problem $(1)$. This is what is generally called the method of mirror images. An alternative approach to constructing the integral representation 
of solutions $(3)$, is to apply to problem $(1)$ the so-called Fourier sine-transform
— that is what you are trying to achieve neglecting formal logic.
A: If I understand your question properly you are asking two things. The first of which is "why is $e^{-i(k-k^\prime)x}$  real?". The answer to this is, it's not. I think your confusion is arising from the fact that the result of the integral is a real function (the Direc-$\delta$ function), however the integral of a complex function is not necessarily complex itself.
Consider Fourier transforming the $\delta$ function:
$$\int_{-\infty}^\infty e^{-i k x} \,\delta(x) \, dx = e^{-i\, k\, 0} = 1$$
from the definition of the $\delta$-function. Therefore the (inverse) Fourier transform of a constant function gives us back the $\delta$. The factor of $2\pi$ comes from the definition of the Fourier transform used here, there are different definitions however.
The second part asked why 
$$\int_{-\infty}^\infty \cos(kx)\cos(k^\prime x)+\sin(kx)\sin(k^\prime x)\, dx = 2\int_{-\infty}^\infty\sin(kx)\sin(k^\prime x)\,dx$$
This is quite easy to see if we consider that
$$\int_a^b f(x) \, dx = \int_{a+c}^{b+c} f(x-c)\, dx,$$
That is, if we shift a function by $c$ but also shift the limits of integration to compensate for this we get the same answer back. So in our case we can shift $\cos(x)$ by $-\pi/2$, but since the limits are $\pm\infty$ they do not change and we use that $\cos(x-\pi/2)=\sin(x)$ giving us the answer. 
Though this integral does not converge and we obtained it through the wrong assumption that $e^{-i (k-k^\prime) x}$ was real.
Hope this helps.
A: Of course use separation of variables:
Let $u(x,t)=X(x)T(t)$ ,
Then $X(x)T'(t)=X''(x)T(t)$
$\dfrac{T'(t)}{T(t)}=\dfrac{X''(x)}{X(x)}=-k^2$
$\begin{cases}\dfrac{T'(t)}{T(t)}=-k^2\\X''(x)+k^2X(x)=0\end{cases}$
$\begin{cases}T(t)=c_3(k)e^{-tk^2}\\X(x)=\begin{cases}c_1(k)\sin xk+c_2(k)\cos xk&\text{when}~k\neq0\\c_1x+c_2&\text{when}~k=0\end{cases}\end{cases}$
$\therefore u(x,t)=\int_0^\infty a(k)e^{-tk^2}\sin xk~dk+\int_0^\infty b(k)e^{-tk^2}\cos xk~dk$
$u(0,t)=0$ :
$\int_0^\infty b(k)e^{-tk^2}~dk=0$
$b(k)=0$
$\therefore u(x,t)=\int_0^\infty a(k)e^{-tk^2}\sin xk~dk$
$u(x,0)=f(x)$ :
$\int_0^\infty a(k)\sin xk~dk=f(x)$
$\mathcal{F}_{s,k\to x}\{a(k)\}=f(x)$
$a(k)=\mathcal{F}^{-1}_{s,x\to k}\{f(x)\}$
$\therefore u(x,t)=\int_0^\infty\mathcal{F}^{-1}_{s,x\to k}\{f(x)\}e^{-tk^2}\sin xk~dk$
