The bilinear transform is a transformation from continuous-time systems (in the Laplace domain) to discrete-time systems (in the Z-domain). It uses the trapezoidal rule for numerical integration.

Derivation

Consider a continuous-time integrator $y\left(t\right)={\int }_{0}^{t}u\left(\tau \right)d\tau$. (Where $y\left(t\right)$ is the output of the integrator for input $u\left(t\right)$).
In the Laplace domain, we can represent these signals as follows: $U\left(s\right)\triangleq \mathcal{L}\left\{u\left(t\right)\right\}$ $Y\left(s\right)\triangleq \mathcal{L}\left\{y\left(t\right)\right\}=\mathcal{L}\left\{{\int }_{0}^{t}u\left(\tau \right)d\tau \right\}=\frac{1}{s}U\left(s\right)$ Therefore, the transfer function of an integrator is: $\begin{array}{}\text{(1)}& {H}_{a}\left(s\right)\triangleq \frac{Y\left(s\right)}{U\left(s\right)}=\frac{1}{s}\frac{U\left(s\right)}{U\left(s\right)}=\frac{1}{s}\end{array}$

If we evaluate $y\left(t\right)$ at a specific time $t=k{T}_{s}$, $y\left(t\right)$ can be written as follows: $y\left[k\right]\triangleq y\left(k{T}_{s}\right)={\int }_{0}^{k{T}_{s}}u\left(\tau \right)d\tau$ By splitting up the integral: $y\left[k\right]={\int }_{0}^{\left(k-1\right){T}_{s}}u\left(\tau \right)d\tau +{\int }_{\left(k-1\right){T}_{s}}^{k{T}_{s}}u\left(\tau \right)d\tau$ This results in a recursive formula for $y\left[k\right]$: $\begin{array}{}\text{(2)}& y\left[k\right]=y\left[k-1\right]+{\int }_{\left(k-1\right){T}_{s}}^{k{T}_{s}}u\left(\tau \right)d\tau \end{array}$ The second term expresses the area under the curve of $u\left(t\right)$ between $t=\left(k-1\right){T}_{s}$ and $t=k{T}_{s}$. It can be approximated in several different ways, using numerical integration techniques. In the case of the bilinear transform, the trapezoidal rule is used, with a step size (sample time) of ${T}_{s}$. This is demonstrated in the following figure.

The light red area on the left is the first term in Equation $\text{(2)}$, and the darker red trapezoid on the right approximates the second term of the equation.
The area of this trapezoid is given by: $A={T}_{s}\frac{u\left(\left(k-1\right){T}_{s}\right)+u\left(k{T}_{s}\right)}{2}=\frac{{T}_{s}}{2}\left(u\left[k-1\right]+u\left[k\right]\right)$ $u\left[k\right]\triangleq u\left(k{T}_{s}\right)$ Therefore, we can approximate Equation $\text{(2)}$: $\begin{array}{}\text{(3)}& y\left[k\right]\approx y\left[k-1\right]+\frac{{T}_{s}}{2}\left(u\left[k-1\right]+u\left[k\right]\right)\end{array}$ We now have an approximation of the recurrence relation for the integrator.

In Equation $\text{(1)}$, we found that the transfer function of an integrator in the Laplace domain was ${H}_{a}\left(s\right)=\frac{1}{s}$. We can now apply the Z-transform to the recurrence relation in Equation $\text{(3)}$ to relate the Laplace domain to the Z-domain. $\begin{array}{rl}& \mathcal{Z}\left\{y\left[k\right]\approx y\left[k-1\right]+\frac{{T}_{s}}{2}\left(u\left[k-1\right]+u\left[k\right]\right)\right\}\\ ⇔\phantom{\rule{1em}{0ex}}& Y\left(z\right)\approx {z}^{-1}Y\left(z\right)+\frac{{T}_{s}}{2}\left({z}^{-1}U\left(z\right)+U\left(z\right)\right)\\ ⇔\phantom{\rule{1em}{0ex}}& \left(1-{z}^{-1}\right)Y\left(z\right)\approx \frac{{T}_{s}}{2}\left(1+{z}^{-1}\right)U\left(z\right)\end{array}$ $\begin{array}{}\text{(4)}& {H}_{d}\left(z\right)\triangleq \frac{Y\left(z\right)}{U\left(z\right)}\approx \frac{{T}_{s}}{2}\frac{z+1}{z-1}\end{array}$ If we compare the continuous-time transfer function ${H}_{a}\left(s\right)$ from Equation $\text{(1)}$ to the approximated discrete-time transfer function ${H}_{d}\left(z\right)$ from Equation $\text{(4)}$, we find an approximation of $s$ in function of $z$, that can be used to discretize a continuous-time transfer function: $s↔\frac{2}{{T}_{s}}\frac{z-1}{z+1}$ We can also express $z$ in function of $s$: $\begin{array}{r}s↔\frac{2}{{T}_{s}}\frac{z-1}{z+1}\\ sz+s↔\frac{2}{{T}_{s}}z-\frac{2}{{T}_{s}}\\ z\left(s-\frac{2}{{T}_{s}}\right)↔-s-\frac{2}{{T}_{s}}\\ z↔\frac{-s-\frac{2}{{T}_{s}}}{s-\frac{2}{{T}_{s}}}\\ z↔\frac{1+\frac{{T}_{s}}{2}s}{1-\frac{{T}_{s}}{2}s}\end{array}$

Alternatively, the identity $z={e}^{s{T}_{s}}$ can be used, together with the Taylor expansion of ${e}^{x}=1+x+\frac{{x}^{2}}{2!}+\frac{{x}^{3}}{3!}+\dots$: $\begin{array}{rl}z& \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}{e}^{s{T}_{s}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{{e}^{s{T}_{s}/2}}{{e}^{-s{T}_{s}/2}}\\ & \phantom{\rule{thickmathspace}{0ex}}\approx \phantom{\rule{thickmathspace}{0ex}}\frac{1+\frac{{T}_{s}}{2}s}{1-\frac{{T}_{s}}{2}s}\end{array}$

Stability

In the Laplace domain, poles that lie to the right of the imaginary axis are unstable. In the Z-domain, poles that lie outside of the unit circle are unstable.
We wish to determine what happens to the stability of poles when applying the bilinear transform.
Let's look at the image of the imaginary axis $\left(s=j\omega \right)$: $\begin{array}{rl}z\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{1+\frac{{T}_{s}}{2}j\omega }{1-\frac{{T}_{s}}{2}j\omega }\\ =\phantom{\rule{thickmathspace}{0ex}}& \frac{1+\frac{{T}_{s}}{2}j\omega }{1-\frac{{T}_{s}}{2}j\omega }\cdot \frac{1+\frac{{T}_{s}}{2}j\omega }{1+\frac{{T}_{s}}{2}j\omega }\\ =\phantom{\rule{thickmathspace}{0ex}}& \frac{{\left(1+\frac{{T}_{s}}{2}j\omega \right)}^{2}}{1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}}\\ =\phantom{\rule{thickmathspace}{0ex}}& \frac{1+2\frac{{T}_{s}}{2}j\omega -{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}}{1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}}\end{array}$ $\begin{array}{}\text{(5)}& z\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{1-{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}}{1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}}+j\frac{2\frac{{T}_{s}}{2}\omega }{1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}}\end{array}$ We'll now calculate ${|z|}^{2}$, you'll see why in a moment. $\begin{array}{rl}{|z|}^{2}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \mathrm{\Re }\left(z{\right)}^{2}+\mathrm{\Im }\left(z{\right)}^{2}\\ =\phantom{\rule{thickmathspace}{0ex}}& \frac{{\left(1-{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}\right)}^{2}}{{\left(1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}\right)}^{2}}+\frac{{\left(2\frac{{T}_{s}}{2}\omega \right)}^{2}}{{\left(1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}\right)}^{2}}\\ =\phantom{\rule{thickmathspace}{0ex}}& \frac{1-2{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}+{\left(\frac{{T}_{s}}{2}\omega \right)}^{4}+4{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}}{{\left(1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}\right)}^{2}}\\ =\phantom{\rule{thickmathspace}{0ex}}& \frac{1+2{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}+{\left(\frac{{T}_{s}}{2}\omega \right)}^{4}}{{\left(1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}\right)}^{2}}\\ =\phantom{\rule{thickmathspace}{0ex}}& \frac{{\left(1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}\right)}^{2}}{{\left(1+{\left(\frac{{T}_{s}}{2}\omega \right)}^{2}\right)}^{2}}\\ {|z|}^{2}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& 1\end{array}$ In other words, the imaginary axis in the s-plane (Laplace domain) maps to the unit circle in the z-plane (Z-domain).

Let's now look at the image of the real axis $\left(s=\sigma \right)$: $z=\frac{1+\frac{{T}_{s}}{2}\sigma }{1-\frac{{T}_{s}}{2}\sigma }$ Substituting $x\triangleq \frac{{T}_{s}}{2}\sigma$ results in: $z=\frac{1+x}{1-x}$ Note that ${T}_{s}$ (the sample time) is positive by definition, so $x$ is positive when $\sigma$ is positive, and $x$ is negative when $\sigma$ is negative. As you can see, the right half of the real axis $\left(\sigma <0\right)$ is mapped to the interval $z\in \left(-1,1\right)$, so inside the unit circle; the left half of the real axis $\left(\sigma >0\right)$ is mapped to the interval $z\in \left(-\mathrm{\infty },-1\right)\cup \left(1,+\mathrm{\infty }\right)$.

We can conclude that the left half of the s-plane is mapped to the part of the z-plane inside of the unit circle, and the right half of the s-plane is mapped to the part of the z-plane outside of the unit circle.
This has a very important consequence: stable poles in the Laplace domain map to stable poles in the Z-domain, and unstable poles in the Laplace domain map to unstable poles in the Z-domain.

Frequency response

In the Laplace domain, we determine the frequency response of a system by evaluating the transfer function at $s=j{\omega }_{a}$. In the Z-domain, on the other hand, we evaluate the transfer function at $z={e}^{j{\omega }_{d}}$.

When designing a filter in the Laplace domain with a certain corner-frequency, we want the corner-frequency to be the same after discretization.
However, we'll find that there is no linear mapping from the frequency response of the continuous-time system to the frequency response of the discrete-time system.

In the previous section, we already found that the imaginary axis of the s-plane maps to the unit circle of the z-plane.
The phase of any $z$ on the unit circle in the Z-domain is the frequency ${\omega }_{d}$ $\left(\left[\text{rad}/\text{sample}\right]\right)$ of a specific point in the frequency response of the discrete-time system.
The imaginary part of any $s$ on the imaginary axis in the Laplace domain is the frequency ${\omega }_{a}$ $\left(\left[\text{rad}/s\right]\right)$ of a specific point in the frequency response of the continuous-time system.
${\omega }_{d}\triangleq \mathrm{\angle }z=\mathrm{arctan}\left(\frac{\mathrm{\Im }\left(z\right)}{\mathrm{\Re }\left(z\right)}\right)$ We'll be using Equation $\text{(5)}$, substituting $\alpha \triangleq \frac{{T}_{s}}{2}$ to make it easier to read. $\begin{array}{rl}& \phantom{\rule{1em}{0ex}}{\omega }_{d}=\mathrm{arctan}\left(\frac{2\alpha {\omega }_{a}}{1-{\alpha }^{2}{\omega }_{a}^{2}}\right)\\ ⇔& \phantom{\rule{1em}{0ex}}\mathrm{tan}\left({\omega }_{d}\right)=\frac{2\alpha {\omega }_{a}}{1-{\alpha }^{2}{\omega }_{a}^{2}}\\ ⇔& \phantom{\rule{1em}{0ex}}\left(1-{\alpha }^{2}{\omega }_{a}^{2}\right)\mathrm{tan}\left({\omega }_{d}\right)=2\alpha {\omega }_{a}\\ ⇔& \phantom{\rule{1em}{0ex}}{\alpha }^{2}\mathrm{tan}\left({\omega }_{d}\right){\omega }_{a}^{2}+2\alpha {\omega }_{a}-\mathrm{tan}\left({\omega }_{d}\right)=0\end{array}$ We can solve this quadratic polynomial in ${\omega }_{a}$ using the discriminant method: $\begin{array}{rl}\mathrm{\Delta }& \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}4{\alpha }^{2}+4{\alpha }^{2}{\mathrm{tan}}^{2}{\omega }_{d}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}4{\alpha }^{2}\left(1+{\mathrm{tan}}^{2}{\omega }_{d}\right)\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}4{\alpha }^{2}{\mathrm{sec}}^{2}{\omega }_{d}\end{array}$ $\begin{array}{rl}{\omega }_{a}& \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-2\alpha ±\sqrt{\mathrm{\Delta }}}{2{\alpha }^{2}\mathrm{tan}{\omega }_{d}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-2\alpha ±2\alpha \mathrm{sec}{\omega }_{d}}{2{\alpha }^{2}\mathrm{tan}{\omega }_{d}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\cdot \frac{1\mp \mathrm{sec}{\omega }_{d}}{\mathrm{tan}{\omega }_{d}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\cdot \frac{\mathrm{cos}{\omega }_{d}\mp 1}{\mathrm{sin}{\omega }_{d}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\cdot \frac{2{\mathrm{cos}}^{2}\frac{{\omega }_{d}}{2}-1\mp 1}{2\mathrm{sin}\frac{{\omega }_{d}}{2}\mathrm{cos}\frac{{\omega }_{d}}{2}}\\ {\omega }_{a,1}& \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\cdot \frac{2{\mathrm{cos}}^{2}\frac{{\omega }_{d}}{2}-2}{2\mathrm{sin}\frac{{\omega }_{d}}{2}\mathrm{cos}\frac{{\omega }_{d}}{2}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\cdot \frac{2\left({\mathrm{cos}}^{2}\frac{{\omega }_{d}}{2}-1\right)}{2\mathrm{sin}\frac{{\omega }_{d}}{2}\mathrm{cos}\frac{{\omega }_{d}}{2}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{1}{\alpha }\cdot \frac{{\mathrm{sin}}^{2}\frac{{\omega }_{d}}{2}}{\mathrm{sin}\frac{{\omega }_{d}}{2}\mathrm{cos}\frac{{\omega }_{d}}{2}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{1}{\alpha }\cdot \frac{\mathrm{sin}\frac{{\omega }_{d}}{2}}{\mathrm{cos}\frac{{\omega }_{d}}{2}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{1}{\alpha }\mathrm{tan}\frac{{\omega }_{d}}{2}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{2}{{T}_{s}}\mathrm{tan}\frac{{\omega }_{d}}{2}\\ {\omega }_{a,2}& \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\cdot \frac{2{\mathrm{cos}}^{2}\frac{{\omega }_{d}}{2}}{2\mathrm{sin}\frac{{\omega }_{d}}{2}\mathrm{cos}\frac{{\omega }_{d}}{2}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\cdot \frac{\mathrm{cos}\frac{{\omega }_{d}}{2}}{\mathrm{sin}\frac{{\omega }_{d}}{2}}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-1}{\alpha }\mathrm{cot}\frac{{\omega }_{d}}{2}\\ & \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\frac{-2}{{T}_{s}}\mathrm{cot}\frac{{\omega }_{d}}{2}\end{array}$ I used some trigonometric double-angle identities to simplify the result.

We get two possible solutions for ${\omega }_{a}$, however, only one is correct.
First, let's look at the case where ${\omega }_{a}\ge 0$: in that case, $\mathrm{\Im }\left(z\right)$ is always positive (see Equation $\text{(5)}$), so ${\omega }_{d}\triangleq \mathrm{\angle }z\in \left[0,\pi \right]$.
The first solution ${\omega }_{a,1}=\frac{2}{{T}_{s}}\mathrm{tan}\frac{{\omega }_{d}}{2}$ is positive, because the tangent function is positive for the argument $\frac{{\omega }_{d}}{2}\in \left[0,\pi /2\right]$.
The second solution ${\omega }_{a,2}=\frac{-2}{{T}_{s}}\mathrm{cot}\frac{{\omega }_{d}}{2}$ is negative, because the cotangent function is positive for the argument $\frac{{\omega }_{d}}{2}\in \left[0,\pi /2\right]$. This is in contradiction to our initial assumption that ${\omega }_{a}\ge 0$.
Now consider the case where ${\omega }_{a}\le 0$: in that case, $\mathrm{\Im }\left(z\right)$ is always negative, so ${\omega }_{d}\triangleq \mathrm{\angle }z\in \left[0,-\pi \right]$.
The first solution ${\omega }_{a,1}=\frac{2}{{T}_{s}}\mathrm{tan}\frac{{\omega }_{d}}{2}$ is negative, because the tangent function is negative for the argument $\frac{{\omega }_{d}}{2}\in \left[0,-\pi /2\right]$.
The second solution ${\omega }_{a,2}=\frac{-2}{{T}_{s}}\mathrm{cot}\frac{{\omega }_{d}}{2}$ is positive, because the cotangent function is negative for the argument $\frac{{\omega }_{d}}{2}\in \left[0,-\pi /2\right]$. This is in contradiction to our initial assumption that ${\omega }_{a}\le 0$.

In conclusion, if we want our digital system to have a specific characteristic at a given frequency ${\omega }_{d}$, we have to use a different frequency ${\omega }_{a}$ when designing the system in the analog domain. This action is called frequency prewarping. The prewarped frequency is given by: $\begin{array}{}\text{(6)}& {\omega }_{a}=\frac{2}{{T}_{s}}\mathrm{tan}\frac{{\omega }_{d}}{2}\end{array}$ Where ${\omega }_{d}$ is the normalized angular frequency in radians per sample. The actual frequency ${f}_{d}$ is given by: ${f}_{d}=\frac{{\omega }_{d}}{2\pi {T}_{s}}$ Note the units of the quantities involved: ${\omega }_{d}$ is given in $\text{rad}/\text{sample}$, dividing by $2\pi$ cancels out the radians. The unit of ${T}_{s}$ is $s/\text{sample}$, the samples cancel out, and the result ${f}_{d}$ is given in $Hz$ or ${s}^{-1}$.