# Change of variables in integrals

Let $\hat{K}$ and $K$ be two open set of $\mathbb{R}^d$. Let $\varphi$ be a ${\cal C}^1$-diffeomorphism from $\hat{K}$ to $K$, i.e. a bijection of class ${\cal C}^1$ whose reciprocal is also of class ${\cal C}^1$. Denote $(e_1,\ldots,e_d)$ the canonical basis of $\mathbb{R}^d$.

We have

$\varphi : \hat{x}=\sum_{i=1}^d \hat{x}_i \, e_i \; \longrightarrow \; \varphi(\hat{x}) = \sum_{i=1}^d \varphi_i(\hat{x}_1,\ldots,\hat{x}_d) \, e_i$

The jacobian matrix of $\varphi$ at a point $\hat{x}$, denote $J_\varphi(\hat{x})$ is the matrix of size $d\times d$ such that its entries read:

$\left( J_\varphi(\hat{x}) \right)_{ij} = \frac{\partial \varphi_i}{\partial \hat{x}_j}(\hat{x}_1,\ldots,\hat{x}_d) \qquad 1\le i,j \le d$

We have the following formula for the change of variable to compute an integral over $K$ as an integral over $\hat{K}$

$\int_K u(x)\; dx = \int_{\hat{K}} u(\varphi(\hat{x}))\; \left| \mathrm{det} J_\varphi(\hat{x}) \right| \; d\hat{x}$
 In the finite element method we have often to compute integrals using change of variables of the type ]\int_K Hu(x)\; dx], where $H$ is an operator (gradient, laplacian, …​). You then have to use to be careful when applying the change of variables.
$\begin{eqnarray*} \int_K (\nabla u(x))^2\; dx & = & \int_K \left[ \left(\frac{\partial u(x,y)}{\partial x} \right)^2 + \left(\frac{\partial u(x,y)}{\partial y} \right)^2 \right]\; dx\; dy \\ & = & \int_{\hat{K}} \left[ \left(\frac{\partial u(F(\hat{x},\hat{y}))}{\partial x} \right)^2 + \left(\frac{\partial u(F(\hat{x},\hat{y}))}{\partial y} \right)^2 \right] \left| \hbox{det} J_F(\hat{x}) \right| \; \; d\hat{x}\, d\hat{y}\\ & = & \int_{\hat{K}} \left[ \left(\frac{\partial u(F(\hat{x},\hat{y}))}{\partial \hat{x}} \; \frac{\partial \hat{x}}{\partial x} + \frac{\partial u(F(\hat{x},\hat{y}))}{\partial \hat{y}} \; \frac{\partial \hat{y}}{\partial x} \right)^2 \right.\\ & & \qquad \left. + \left(\frac{\partial u(F(\hat{x},\hat{y}))}{\partial \hat{x}} \; \frac{\partial \hat{x}}{\partial y} + \frac{\partial u(F(\hat{x},\hat{y}))}{\partial \hat{y}} \; \frac{\partial \hat{y}}{\partial y} \right)^2 \right] \left| \hbox{det} J_F(\hat{x}) \right| \; \; d\hat{x}\, d\hat{y} \end{eqnarray*}$
$\int_{\hat{K}} \left[ \left(\frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{x}} \; \frac{\partial \hat{x}}{\partial x} + \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{y}} \; \frac{\partial \hat{y}}{\partial x} \right)^2 + \left(\frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{x}} \; \frac{\partial \hat{x}}{\partial y} + \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{y}} \; \frac{\partial \hat{y}}{\partial y} \right)^2 \right] \left| \hbox{det} J_F(\hat{x}) \right| \; \; d\hat{x}\, d\hat{y}$

In the case the transformation $F$ is affine, for example

$\left\{ \begin{array}{lll} x & = & a\hat{x} + b\hat{y} + e\\ y & = & c\hat{x} + d\hat{y} + f \end{array} \right.$

we have

\begin{aligned} \hat{x} &= \frac{d(x-e)-b(y-f)}{D},\\ \hat{y} &= \frac{-c(x-e)+a(y-f)}{D},\\ \left| \hbox{det} J_F(\hat{x}) \right| &= D = ad-bc \end{aligned}

The previous calculus becomes

\begin{aligned} \int_K (\nabla u(x))^2\; dx &= \int_{\hat{K}} \left[ \left(\frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{x}} \; \frac{d}{D} + \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{y}} \; \frac{-c}{D} \right)^2 + \left(\frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{x}} \; \frac{-b}{D} + \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{y}} \; \frac{a}{D} \right)^2 \right] |D| \; \; d\hat{x}\, d\hat{y}\\ & = \frac{1}{|D|}\; \int_{\hat{K}} \left[ \left( d\, \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{x}} - c\, \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{y}} \right)^2 + \left(-b\, \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{x}} \; + a\, \frac{\partial \hat{u}(\hat{x},\hat{y})}{\partial \hat{y}} \right)^2 \right] \; \; d\hat{x}\, d\hat{y} \end{aligned}

## 1. Some change of variable formulas

Denote $f: K \mapsto \mathbb{R}$ and $\hat{f}: \hat{K} \mapsto \mathbb{R}$ such that $\hat{f} = f \circ F$ and ]\mathbf{F}: K \mapsto \mathbb{R}^d] and $\mathbf{\hat{F}}: \hat{K} \mapsto \mathbb{R}^d$ such that $\hat{\mathbf{F}} = \mathbf{F} \circ \chi^e$.

Moreover denote $\mathbf{n}$ the local outward normal to $\Omega$ and $\mathbf{n}$ the local outward normal to $\hat{\Omega}$.

we have the following relations

\begin{aligned} \int_{K} \ f\ dx\ &= \int_{\hat{K}} f( \chi^e(\xi) ) J^e( \xi )\ d \xi \ =\ \int_{\hat{K}} \hat{f}(\xi) J^e( \xi )\ d \xi\\ \int_{K}\ \nabla f\ dx\ &=\ \int_{\hat{K}} \Big(\nabla^{\text{st}} \underbrace{\hat{f}(\xi)}_{f \circ \chi^e(\xi)} B^e(\xi)\Big) J^e( \xi )\ d \xi\\ \int_{\partial K}\ f( x )\ dx &= \int_{\partial \hat{K}} \hat{f}(\xi)\ \| B^e(\xi)^T \ \mathbf{n^{\text{st}}}(\xi) \|\ J^e( \xi )\ d \xi\\ \int_{\partial K}\ \mathbf{F}( x )\ \cdot\ \mathbf{n}(x) dx & = \int_{\partial \hat{K}} \mathbf{\hat{F}}( \xi )\ \cdot \Big(B^e(\xi)^T \ \mathbf{n^{\text{st}}}(\xi) \Big) \ J^e( \xi )\ d \xi \end{aligned}