Consider the unsteady one dimensional heat conduction without any source term.
\begin{equation}
\frac{\partial (\rho C_{p} T)}{\partial t} = \frac{\partial}{\partial x} (K \frac{\partial T}{\partial x})
\end{equation}We shall integrate LHS and RHS before discretisation.
\begin{equation}
\int_{w}^{e}\int_{t}^{t+\Delta t} \frac{\partial (\rho C_{p} T)}{\partial t}dt.dx =\int_{t}^{t+\Delta t} \int_{w}^{e} \frac{\partial}{\partial x} (K \frac{\partial T}{\partial x})dt.dx
\end{equation}In LHS, the time integration carries out first.
\begin{split}
LHS &= \int_{w}^{e} \Big\lbrack \int_{t}^{t+\Delta t} \frac{\partial (\rho C_{p} T)}{\partial t}dt\Big\rbrack dx \\
& = \int_{w}^{e} \Big\lbrack (\rho C_{p} T)^{t+\Delta t} - (\rho C_{p} T)^{t} \Big\rbrack dx\\
\end{split}notating
\begin{equation}
\begin{split}
LHS & = \int_{w}^{e} \Big\lbrack (\rho C_{p} T)^{t+\Delta t} - (\rho C_{p} T)^{t} \Big\rbrack dx \\
& = \rho C_{p} (T^{t+\Delta t} - T^{t})\Delta x\\
\end{split}
\end{equation}\begin{split}
RHS &= \int_{t}^{t+\Delta t} \Big\lbrack \int_{w}^{e} \frac{\partial}{\partial x} (K \frac{\partial T}{\partial x})dx \Big\rbrack dt \\
& = \int_{t}^{t+\Delta t} \Big\lbrack (K \frac{\partial T}{\partial x})_{e} - (K \frac{\partial T}{\partial x})_{w} \Big\rbrack dt\\
& = \int_{t}^{t+\Delta t} \Big\lbrack K_{e} \frac{ T_{E} - T_{P} }{\delta x_{e}} - K_{w} \frac{ T_{P} - T_{W} }{\delta x_{w}} \Big\rbrack dt\\
\end{split}Now, in order to carryout the space integration, we need to have an assumption for variation of T with respect to time t. Assuming the “piecewise linear” variation in time, i.e., weighted composition of previous and current time where f is the weight.
\int_{t}^{t+\Delta t} T dt = \Big[(1-f)T^{t} - f T^{t+\Delta t} \Big]\Delta t\begin{split}
RHS &= \int_{t}^{t+\Delta t} \Big\lbrack K_{e} \frac{ T_{E} - T_{P} }{\delta x_{e}} - K_{w} \frac{ T_{P} - T_{W} }{\delta x_{w}} \Big\rbrack dt\\
&= \Big [\frac{K_{e}}{\delta x_{e}} \Big ([ (1-f)T_{E}^{t} - f T_{E}^{t+\Delta t} ] - [ (1-f)T_{P}^{t} - f T_{P}^{t+\Delta t} ] \Big ) \\
&- \frac{K_{w}}{\delta x_{w}} \Big ([ (1-f)T_{P}^{t} - f T_{P}^{t+\Delta t} ] - [ (1-f)T_{W}^{t} - f T_{W}^{t+\Delta t} ] \Big ) \Big ] \Delta t\\
\end{split}denoting T^{t} as T^{o} and T^{t+\Delta t} as T .
\begin{equation}
\begin{split}
RHS &= \Big [\frac{K_{e}}{\delta x_{e}} \Big ([ (1-f)T_{E}^{o} - f T_{E} ] - [ (1-f)T_{P}^{o} - f T_{P} ] \Big ) \\
&- \frac{K_{w}}{\delta x_{w}} \Big ([ (1-f)T_{P}^{o} - f T_{P} ] - [ (1-f)T_{W}^{o} - f T_{W} ] \Big ) \Big ] \Delta t\\
\end{split}
\end{equation}\begin{equation}
\begin{split}
LHS & = \rho C_{p} (T_{P} - T_{P}^{o})\Delta x\\
\end{split}
\end{equation}Equating LHS and RHS, and writing in the standard discretisation form,
a_{P}T_{P} = a_{E}T_{E}+a_{W}T_{W}+a_{P}^{o}T_{P}^{o}+b\\
where
a_{E} = f\frac{K_{e}}{\delta x_{e}} , \text{ } a_{W} = f\frac{K_{w}}{\delta x_{w}} , \text{ } a_{P} = a_{E} +a_{W}+\rho C_{p} \frac{\Delta x}{\Delta t}\\
a_{P}^{o} = \rho C_{p} \frac{\Delta x}{\Delta t} -(1- f) \frac{K_{e}}{\delta x_{e}}-(1- f) \frac{K_{w}}{\delta x_{w}}\\
b =(1-f) \frac{K_{e}}{\delta x_{e}} T_{E}^{o} +(1-f) \frac{K_{w}}{\delta x_{w}} T_{W}^{o}f = \begin{cases}
0 &\text{Explicit scheme } \\
0.5 &\text{Crank-Nicholson scheme } \\
1 &\text{Fully implicit scheme } \\
\end{cases}Condition for stability for isotropic uniform grid, based on setting the requirement of positive value for a_{P}^{o}
\frac{\alpha \Delta t}{(\Delta x)^{2}} \ge \begin{cases}
\frac{1}{2} &\text{Explicit scheme } \\
1 &\text{Crank-Nicholson scheme } \\
0 &\text{Fully implicit scheme } \\
\end{cases}