heat equation from half space to the whole space I understand that the solution to the heat equation can be analytically written down if the equation is defined on the entire real like. However, even if the equation is defined on the half space(where the boundary condition is set to 0), the initial data can be extended to the entire line as an odd function to apply the known results from the entire domain. Why in an odd way? What is the intuition behind it? I have seen mentioning that that way we satisfy the boundary condition but I'd think the even way would satisfy, why odd extension?
Edit: I think I understand why odd function satisfies BC $0$ but what if BC is a function of $t$? What is magical about $0$?
 A: Dirichlet boundary conditions (e.g. $u(0,t) = u(1,t) = 0$) correspond to an odd extension. This makes sense because for any odd function $f$, $f(0) = f(1) = 0$, if the period of $f$ is 1.
On the other hand, Neumann boundary conditions ($u_x(0,t) = u_x(1,t) = 0$) correspond to an even extension. For any even extension, those boundary conditions hold.
This is discussed in Walter Strauss's book "Partial Differential Equations" in section 5.2.
You might ask why we can't just use an even extension for Dirichlet boundary conditions. Strauss doesn't mention this, so these are my own thoughts. Let's say $f(x) = \sin(2\pi x)$, and we are interested in the interval $[0, 1]$. I think the issue with the even extension is that it would not be differentiable, much less smooth. There would be a kink in the graph at 0, like the function $|x|$. This could introduce problems, and there's just no point to doing that. So that's an example of why forcing an even extension to satisfy the Dirichlet boundary conditions just doesn't make much sense.
A: A good way of understanding this is with the use of Riemann functions.

Suppose we have to solve the problem
$$
L u = u_t - u_{xx} = w(x,t), \qquad 0 < x < \infty, \quad 0 < t,
$$
$$
u(x,0) = f(x), \hspace{8.4em}
$$
$$
u(0,t) = g(t). \hspace{8.4em}
$$

Let $v$ be a function with all the needed properties (so the following calculations are valid). Then,
\begin{align}
\iint_\Omega v Lu \,dx dt &= \iint_\Omega v(u_t - u_{xx})dx dt \\
&= \iint_\Omega \Big\{ (v u)_t + (v_x u - v u_x)_x - (v_t + v_{xx})u \Big\}dxdt \\
&= \iint_\Omega \Big\{ (v u)_t + (v_x u - v u_x)_x - u L^*v\Big\}dxdt,
\end{align}
where $\Omega = [0, R) \times [0,T)$ and $L^*$ is the adjoint operator of $L$. If $u$ is a solution of the original problem,
\begin{align}
0 &= \iint_\Omega \text{div} \begin{pmatrix} v_x u - v u_x \\ v u\end{pmatrix} dx dt - \iint_\Omega u L^* v\,dx dt - \iint_\Omega vw\,dxdt \\
&= \int_{\partial \Omega} \begin{pmatrix} v_x u - v u_x \\ v u\end{pmatrix} \cdot \hat{n}\,dS - \iint_\Omega u L^* v\,dx dt - \iint_\Omega vw\,dxdt, \tag{1}
\end{align}
where we have used the divergence theorem, and $\hat{n}$ is the (unitary) exterior normal vector of $\delta \Omega$.
Now,
\begin{multline}
\int_{\partial \Omega} \begin{pmatrix} v_x u - v u_x \\ v u\end{pmatrix} \cdot \hat{n}\,dS = \int_0^R (-vu)\Big|_{t = 0}\,dx + \int_0^T (v_x u - v u_x)\Big|_{x = R}\,dt \\
+ \int_0^L (uv)\Big|_{t = T}\,dx - \int_0^T (v_x u - v u_x)\Big|_{x = 0}\,dt.
\end{multline}
Using the initial and boundary conditions for $u$,
\begin{multline}
\int_{\partial \Omega} \begin{pmatrix} v_x u - v u_x \\ v u\end{pmatrix} \cdot \hat{n}\,dS = -\int_0^R v\Big|_{t = 0} f(x) dx + \int_0^T (v_x u - v u_x)\Big|_{x = R}\,dt \\
+ \int_0^L (uv)\Big|_{t = T}\,dx - \int_0^T v_x\Big|_{x = 0} g(t) dt + \int_0^T (v u_x)\Big|_{x = 0} dt
\end{multline}
If we find $v$ such that
$$
v_t + v_{xx} = 0, \qquad 0 < x < \infty,\quad 0 < t < T,
$$
$$
\lim_{R \to \infty} v = \lim_{R \to \infty} v_x = 0,
$$
and
$$
v = 0 \text{ for } x = 0, 
$$
then we can rewrite eq. (1) as
$$
\int_0^L (uv)\Big|_{t = T}\,dx = \int_0^\infty v f(x) dx + \int_0^T v_x g(t) dt + \int_0^\infty\int_0^T v w(x,t)\,dxdt.
$$
"Why are we doing all this?", you may ask. The reason for this (which is also the reason why I've been so secretive about the arguments of the function $v$) is that, if
$$
v(x,T) = \delta(x-y),
$$
then
$$
u(y,T) = \int_0^\infty v f(x) dx + \int_0^T v_x g(t) dt + \int_0^\infty\int_0^T v w(x,t)\,dxdt.
$$

In other words, if we can find $v(x,y,t,T)$ such that
  $$
v_t + v_{xx} = 0, \quad 0 < x < \infty, \quad 0 < t < T,
$$
  $$
v(0,y,t,T) = 0,
$$
  $$
v(x,y,T,T) = \delta(x-y)
$$
  $$
\lim_{x \to \infty} v(x,y,t,T) = \lim_{x \to \infty} v_x(x,y,t,T) = 0,
$$
  we'll be able to find the solution of the semi-infinite problem.
The function $v(x,y,t,T)$ is known as the Riemann function of $L$ (plus initial and boundary conditions).

But where, oh where, can we find a function that is related to the heat equation, the $\delta$ function and decays smoothly at infinity?
You're right! The heat kernel!
It's fairly easy to see that
$$
K(x-y,T-t) = \frac{e^{-\frac{(x-y)^2}{4 (T - t)}}}{\sqrt{4 \pi (T - t)}},
$$
is a solution of $L^* v = 0$, satisfies the $\delta$ condition and decays very well.
What about boundary conditions?
The Riemann function for this problem has to satisfy Dirichlet boundary condition. Every odd function in $x$ will satisfy the condition. Thus, a natural property for $v$ to have is
$$
v(-x,y,t,T) = -v(x,y,t,T),
$$
which can be thought as the odd extension of $v$ to $\mathbb{R}$.
Therefore,
$$
v(x,y,t,T) = K(x-y,T-t) - K(-x-y,T-t),
$$
and the solution of the original problem is
\begin{multline}
u(y,T) = \int_0^\infty v(x,y,0,T)f(x)\,dx + \int_0^T v_x(0,y,t,T) g(t)\,dt \\ 
+ \int_0^\infty\int_0^T v(x,y,t,T)w(x,t)\,dxdt.
\end{multline}
If we had Neumann boundary conditions instead, the same construction would lead to $v_x(0,y,t,T) = 0$, the need for $v$ to be an even function of $x$, i.e.,
$$
v(x,y,t,T) = K(x-y,T-t) + K(-x-y,T-t)
$$
and the solution
\begin{multline}
u(y,T) = \int_0^\infty v(x,y,0,T)f(x)\,dx - \int_0^T v(0,y,t,T) g(t)\,dt \\ 
+ \int_0^\infty\int_0^T v(x,y,t,T)w(x,t)\,dxdt.
\end{multline}
A fantastic exercise is to work out with a finite interval (where you'll have to perform a periodic extension and, in order to satisfy the boundary conditions, express $v$ as an infinite sum of heat kernels!).
