# Explicit and implicit methods

Explicit and implicit methods are approaches used in numerical analysis for obtaining numerical approximations to the solutions of time-dependent ordinary and partial differential equations, as is required in computer simulations of physical processes. Explicit methods calculate the state of a system at a later time from the state of the system at the current time, while implicit methods find a solution by solving an equation involving both the current state of the system and the later one. Mathematically, if $Y(t)$ is the current system state and $Y(t+\Delta t)$ is the state at the later time ($\Delta t$ is a small time step), then, for an explicit method
    $Y(t+\Delta t)=F(Y(t))\,$
while for an implicit method one solves an equation
    $G{\BigY(t),Y(t+\Delta t){\Big )}=0\qquad (1)\,$
to find $Y(t+\Delta t).$

## Computation

Implicit methods require an extra computation (solving the above equation), and they can be much harder to implement. Implicit methods are used because many problems arising in practice are stiff, for which the use of an explicit method requires impractically small time steps $\Delta t$ to keep the error in the result bounded (see numerical stability). For such problems, to achieve given accuracy, it takes much less computational time to use an implicit method with larger time steps, even taking into account that one needs to solve an equation of the form (1) at each time step. That said, whether one should use an explicit or implicit method depends upon the problem to be solved.
Since the implicit method cannot be carried out for each kind of differential operator, it is sometimes advisable to make use of the so called operator splitting method, which means that the differential operator is rewritten as the sum of two complementary operators
    $Y(t+\Delta t)=F(Y(t+\Delta t))+G(Y(t)),\,$
while one is treated explicitly and the other implicitly. For usual applications the implicit term is chosen to be linear while the explicit term can be nonlinear. This combination of the former method is called Implicit-Explicit Method (short IMEX,).

## Illustration using the forward and backward Euler methods

Consider the ordinary differential equation
    ${\frac {dy}{dt}}=-y^{2},\ t\in [0,a]\quad \quad (2)$
with the initial condition $y(0)=1.$ Consider a grid $t_{k}=a{\frac {k}{n}}$ for 0 ≤ k ≤ n, that is, the time step is $\Delta t=a/n,$ and denote $y_{k}=y(t_{k})$ for each $k$. Discretize this equation using the simplest explicit and implicit methods, which are the forward Euler and backward Euler methods (see numerical ordinary differential equations) and compare the obtained schemes.

### Forward Euler method

The forward Euler method
    $\left({\frac {dy}{dt}}\right)_{k}\approx {\frac {y_{k+1}-y_{k}}{\Delta t}}=-y_{k}^{2}$
yields
    $y_{k+1}=y_{k}-\Delta ty_{k}^{2}\quad \quad \quad (3)\,$
for each $k=0,1,\dots ,n.$ This is an explicit formula for $y_{k+1}$.

### Backward Euler method

With the backward Euler method
    ${\frac {y_{k+1}-y_{k}}{\Delta t}}=-y_{k+1}^{2}$
one finds the implicit equation
    $y_{k+1}+\Delta ty_{k+1}^{2}=y_{k}$
for $y_{k+1}$ (compare this with formula (3) where $y_{k+1}$ was given explicitly rather than as an unknown in an equation).
This is a quadratic equation, having one negative and one positive root. The positive root is picked because in the original equation the initial condition is positive, and then $y$ at the next time step is given by
    $y_{k+1}={\frac {-1+{\sqrt {1+4\Delta ty_{k}}}}{2\Delta t}}.\quad \quad (4)$
In the vast majority of cases, the equation to be solved when using an implicit scheme is much more complicated than a quadratic equation, and no analytical solution exists. Then one uses root-finding algorithms, such as Newton's method, to find the numerical solution.

### Crank-Nicolson method

With the Crank-Nicolson method
    ${\frac {y_{k+1}-y_{k}}{\Delta t}}=-{\frac {1}{2}}y_{k+1}^{2}-{\frac {1}{2}}y_{k}^{2}$
one finds the implicit equation
    $y_{k+1}+{\frac {1}{2}}{\Delta t}y_{k+1}^{2}=y_{k}-{\frac {1}{2}}\Delta ty_{k}^{2}$
for $y_{k+1}$ (compare this with formula (3) where $y_{k+1}$ was given explicitly rather than as an unknown in an equation). This can be numerically solved using root-finding algorithms, such as Newton's method, to obtain $y_{k+1}$.
Crank-Nicolson can be viewed as a form of more general IMEX (Implicit-Explicit) schemes.

### Forward-Backward Euler method

In order to apply the IMEX-scheme, consider a slightly different differential equation:
    ${\frac {dy}{dt}}=y-y^{2},\ t\in [0,a]\quad \quad (5)$
It follows that
    $\left({\frac {dy}{dt}}\right)_{k}\approx y_{k+1}-y_{k}^{2},\ t\in [0,a]$
and therefore
    $y_{k+1}={\frac {y_{k}(1-y_{k}\Delta t)}{1-\Delta t}}\quad \quad (6)$
for each $k=0,1,\dots ,n.$