Can someone help me understand this a bit better:

$\int (x-y)^2 dx = \int(y-x)^2dx$

as $(y-x)^2 = (x-y)^2$. Now, if I make the change $z = x-y$ in the one on the LHS I get:

$\int z^2 dz$

as $dz = dx$. Now, if I make the change $z=y-x$ in the one on the RHS I get:

$\int z^2 (-dz)$

as $dz = -dx$. This implies that

$\int z^2 dz = - \int z^2 dz = 0$

which is clearly not true. I don't understand - can someone help me understand changing the variable of integration when you have a square or a square root please?


In the first case, $z=x-y$. In the second case $z=y-x$. It doesn't follow that $\int z^2 dz = - \int z^2 dz = 0$, because these are two different $z$'s. The confusion comes from the fact that you used the same variable name for two different values. Look at it again, but with a different variable for the second case:



$$\begin{align} \int{z^2}dz&=-\int{u^2}du \\ \frac{1}{3}z^3+C &= -\frac{1}{3}u^3+C \end{align}$$

This follows because $z=-u$.

  • $\begingroup$ That makes sense. So what about a Gaussian integral: $\int exp[-(x-y)^2] dx = \int exp[-(y-x)^2] dx$ $\endgroup$ – John Raddison Jul 18 '13 at 20:01
  • $\begingroup$ @JohnRaddison The exact same principle applies. The Gaussian is an even function, so its integral will be an odd function, just like in the case you gave. $\endgroup$ – Ataraxia Jul 18 '13 at 20:04
  • $\begingroup$ $z = x-y$ & $u = y-x$ $\int \exp[-z^2/2] dz = - \int \exp[-u^2/2] du $ $\sqrt(2 \pi) = - \sqrt(2 \pi)$ $\endgroup$ – John Raddison Jul 18 '13 at 20:07

You are using $z$ on both sides of the equation as if it contains the same value, when in fact it does not.

On the LHS, $z = x-y$, and on the RHS, $z = y-x$. These are two different z values. To clarify, you should use $z1 = x-y$ and $z2 = y-x$, which makes it obvious that $z1 = -z2$.


With a definite integral you get

$$\int_a^b (x-y)^2\,\mathrm dx=\int_{a-y}^{b-y}z^2\,\mathrm dz $$ and $$\int_a^b (y-x)^2\,\mathrm dx=\int_{y-a}^{y-b}z^2\,\mathrm d(-z) =\int_{y-b}^{y-a}z^2\,\mathrm dz$$ which both give the same value $\frac13(b-y)^3-\frac13(a-y)^3$.

As you also tagged the question as measure-theory (presumably Lebesgue integral), note that in that case you need to take the absolute value of the derivative in substitution, i.e. again you get $$\int_A z^2\,\mathrm dz=\int_{-A}z^2\,\mathrm dz$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.