# How I should behave when a change-of-variables (integrals) is not injective?

## ##What follows is how my doubt was born. If you want, you can directly read my true question at "the bottom"##

Let's suppose to have a domain like this: $$\Bbb V=\{(x+1)^2+(y-2)^2+(z+3)^2\le1\}$$ and I want to evaluate $$\int_{\Bbb V}1\,dx\,dy\,dz$$.

It's obvious that a good change-of-variables is $$\Phi:(u,v,w)\rightarrow(x,y,z)$$, $$\begin{cases}(x+1)=u \\ (y-2)=v \\ (z+3)=w\end{cases}$$

Such a $$\Phi$$ is an injective function, so it doesn't cause any trouble to me: $$\Bbb V$$ is simply rewritten as $$\Bbb V^*=\{u^2+v^2+w^2\le1\}$$ and the integral is done simply as $$\int_{\Bbb V^*}1\,du\,dv\,dw$$

Now take the domain $$\Bbb V = \{x^2 + y^4+z^2\le1\}$$ and $$\int_{\Bbb V}1\,dx\,dy\,dz$$.

I would like to transform it into a sphere through $$\Phi:(u,v,w)\rightarrow(x,y,z)$$, $$\begin{cases}x=u \\ y^2=v \\ z=w\end{cases}$$

But $$\Phi$$ is NOT an injective function, so I have to separate the cases $$(y\le0 ,\ y\ge0)$$ that would result into a new domain $$\Bbb V^-=\{u^2+v^2+w^2\le1,\ v\le0\}\, \bigcup\, \Bbb V^+=\{u^2+v^2+w^2\le1,\ v\ge0\}$$.

Anyway, I'm really confused about how $$(v\le0 ,\ v\ge0)$$ came; moreover the right new-integral should be: $$\int_{\Bbb V^+}\frac{1}{2 \sqrt{v}}\,du\,dv\,dw \quad + \quad \int_{\Bbb V^-}\frac{1}{2 \sqrt{-v}}\,du\,dv\,dw$$

And I am even more confused about the signs under these roots...
The only way I found to understand "how" is to apply different change-of-variables for each case: $$y\ge0 \rightarrow\begin{cases}x=u \\ +\ y^2=v \\ z=w\end{cases} \qquad y\le0 \rightarrow\begin{cases}x=u \\ -\ y^2=v \\ z=w\end{cases}$$

But that method doesn't seem too legit to me..

=============

Then I noticed that $$(v)$$ as independent variable can assume both positive and negative values, instead the function $$(y^2)$$ can assume only positive values; so the right change-of-variables is $$\Phi:(u,v,w)\rightarrow(x,y,z)$$, $$\begin{cases}x=u \\ y^2=|v| \\ z=w\end{cases}$$

That $$\Phi$$ also doesn't cause any trouble to me: $$\Bbb V$$ is simply rewritten as $$\Bbb V^*=\{u^2+v^2+w^2\le1\}$$ and the integral is done simply as $$\int_{\Bbb V^*}\frac{1}{2 \sqrt{|v|}}\,du\,dv\,dw$$; and that method seems much more legit to me.

Furthermore that method does't cause any confusion to me, because it's a simply observation about the $$\Phi$$ I choose and it has nothing to do with the domain $$\Bbb V$$, I guess.

What really caused me trouble is that exercise:
Consider the domain: $$\Bbb D = \{1\le x\cdot y \le 2 ,\, 1\le \frac{x}{y} \le2\}$$, then evaluate the integral: $$\int_{\Bbb D}1\,dx\,dy$$.

I tried the change-of-variable $$\Phi:(u,v)\rightarrow(x,y)$$, $$\begin{cases}x \cdot y=u \\ \frac{x}{y}=v\end{cases}$$

But such a $$\Phi$$ is clearly not injective, so I have to separate the cases. But, at this point, I get confused about what really means "separate the cases"...

Eventually I noticed that the domain provides the information $$(x \cdot y \ge 0 ,\ \frac{x}{y} \ge 0)$$, instead $$[(u), \ (v)]$$ as independent variables can assume both positive and negative values; so I thought the right change-of-variables should be:
$$\Phi:(u,v)\rightarrow(x,y)$$, $$\begin{cases}x \cdot y=|u| \\ \frac{x}{y}=|v|\end{cases}$$

But $$\Bbb D^*=\{1\le|u|\le2,\ 1\le|v|\le2\}$$ isn't yet the right domain.. I got really confused about, and I thought the problem was that that observation is "$$\Bbb D$$-dependant" and NOT (like above) "$$\Phi$$-dependant".

Eventually, I found that writing such a $$\Bbb D^*$$ I was losing the information that $$[(u) ,\ (v)]$$ can't change their sign independently of each other: since $$(u \simeq x \cdot y) ,\ \left(v \simeq \frac{x}{y}\right)$$, then they must have the same sign. Thus the right domain is: $$\Bbb D^*=\{1\le|u|\le2,\ 1\le|v|\le2\ ,\ u \cdot v \ge 0\}$$, and the integral become: $$\int_{\Bbb D^*}\frac{1}{2 |v|}\,du\,dv$$. This is correct.

Therefore, this method seems a bit weird to me because is strictly dependant by the domain $$\Bbb D$$, and not by the chosen $$\Phi$$, with a loss of generality.

## ##The bottom##

Is there a GENERAL theory which is "$$\Phi$$-oriented" and doesn't take care of the domain?

(If doesn't) How I should recognize the behavior of the domain transformation?
– I mean, is there any useful tips or some common situations that I can easily recognize?–

You say you have a problem with functions that are not injective, but I think what you really have trouble with is how to define a function.

Suppose we write $$\Phi:(u,v,w)\rightarrow(x,y,z),\ \begin{cases} x=u, \\ y^2=\lvert v\rvert, \\ z=w.\end{cases}$$

What is this? It is not an "injective function" because it is not yet a function of any kind. A function must have a domain and a codomain and must associate a unique object in the codomain with each object in the range.

Suppose we say the domain is $$\{(u,v,w) : u^2 + v^2 + w^2 \leq 1\}.$$ What does $$\Phi$$ say when $$v = \frac14$$? We have two solutions for $$y^2 = \frac14$$, namely, $$y = \frac12$$ and $$y = -\frac12.$$ Which one of these is uniquely associated with $$v = \frac14$$? The formula does not say, so it does not define a function.

We could fix this by saying $$y = \sqrt{\lvert v\rvert}.$$ The square root function $$\sqrt{\cdot}$$ dictates that we always take the positive solution for $$y$$ in $$y^2=\lvert v\rvert.$$

We also have the concern that $$\left\lvert-\frac14\right\rvert = \left\lvert\frac14\right\rvert,$$ so the formula for $$\Phi$$ does not tell us how we should get a different value of $$y$$ when $$v = -\frac14$$ than we do when $$v = \frac14$$. The previous "fix" using $$\sqrt{\cdot}$$ does not help at all; it merely ensures that the function is not injective.

You actually were much closer to a legitimate definition of $$\Phi$$ when you did it by cases. Piecewise definitions of functions (defining the function with one formula in one case, and a different formula in another case) are completely and totally legitimate.

It is also completely and totally legitimate to divide a domain into two pieces whose intersection has measure zero and integrate over the two pieces separately.

The only thing that this definition "by cases" was missing was a way to assign the value of $$y$$ uniquely for each value of $$v$$ in such a way that you produce all the $$y$$-values you need and never map two distinct values of $$v$$ to the same $$y$$-value.

A way you can do that is to say $$y = \begin{cases} \sqrt{v} & v \geq 0, \\ -\sqrt{- v} & v < 0. \end{cases}$$ Now you get one and only one value of $$y$$ for each value of $$v,$$ and never map two distinct values of $$v$$ to the same value of $$y.$$

This would then enable you to legitimately integrate each piece of the domain, $$\Bbb V^+$$ and $$\Bbb V^-$$, resulting in the integral

$$\int_{\Bbb V^+}\frac{1}{2 \sqrt{v}}\,du\,dv\,dw \quad + \quad \int_{\Bbb V^-}\frac{1}{2 \sqrt{-v}}\,du\,dv\,dw.$$

But notice: in $$\Bbb V^+,$$ you always have $$v \geq 0,$$ so $$\lvert v\rvert = v.$$ So the first integral in the sum can just as well be written $$\int_{\Bbb V^+}\frac{1}{2 \sqrt{\lvert v\rvert}}\,du\,dv\,dw.$$

On the other hand, in $$\Bbb V^-$$ you always have $$v \leq 0,$$ so $$\lvert v\rvert = -v.$$ Therefore the second integral in the sum can just as well be written $$\int_{\Bbb V^-}\frac{1}{2 \sqrt{\lvert v\rvert}}\,du\,dv\,dw.$$

In short, if we write the integrands in this fashion, using $$\lvert v\rvert$$ instead of $$v$$ or $$-v,$$ the integrands on each piece of the domain are the same. So we can just as well integrate this same integrand over the entire domain:

$$\int_{\Bbb V}\frac{1}{2 \sqrt{\lvert v\rvert}}\,du\,dv\,dw.$$

Notice that this is the same conclusion you leaped to when you tried to define $$\Phi$$ by the formula $$y^2=\lvert v\rvert.$$ I say "leaped" because in the second attempt, you never defined $$(x,y,z)$$ as a function of $$(u,v,w)$$; you had two values of $$y$$ that could be associated with two values of $$v,$$ but nothing to say which value of $$v$$ mapped to which value of $$y.$$

The only flaw in your first attempt was in the clarity and presentation of the ideas. You can simply define the parts of the domain, $$\Bbb V = \Bbb V^+\cup\Bbb V^-,$$ such that $$v \geq 0$$ in $$\Bbb V^+$$ and $$v \leq 0$$ in $$\Bbb V^-,$$ then define the mapping $$\Phi$$ such that $$y^2 = v,\ y \geq 0$$ in $$\Bbb V^+$$ and $$-y^2 = v, \ y \leq 0$$ in $$\Bbb V^-.$$ If you put together the things you said about $$\Bbb V^+$$ and $$\Bbb V^-$$ in a coherent, logical progression, you would have said something like that.

Equivalently, you could say $$y = \sqrt{\lvert v\rvert}$$ in $$\Bbb V^+$$ and $$y = -\sqrt{\lvert v\rvert}$$ in $$\Bbb V^-.$$

By the way, there is nothing that actually says you must have $$y \geq 0$$ in $$\Bbb V^+$$ and $$y \leq 0$$ in $$\Bbb V^-.$$ You could just has easily have $$y \leq 0$$ in $$\Bbb V^+$$ and $$y \geq 0$$ in $$\Bbb V^-.$$ This is just one of the many arbitrary choices we are allowed to make during a change of variables. For example, when doing a change of variables for $$\{(x+1)^2+(y-2)^2+(z+3)^2\le1\}$$ you can just as well say $$2-y = v$$ rather than $$y - 2 = v$$; either one will give you an injective function from the unit ball at the origin to the original domain.

For the example $$\Bbb D = \{1\le x\cdot y \le 2 ,\, 1\le \frac{x}{y} \le2\}$$, notice that $$x$$ can be positive or negative, but $$x$$ and $$y$$ must always have the same sign. Moreover, the domain is already divided into two disconnected pieces, one containing only positive $$x$$ and $$y,$$ the other containing only negative $$x$$ and $$y.$$ So it is completely natural that you would look at each of these parts of the domain individually before putting your answer together.

## The Big Question

Is there a GENERAL theory which is "$$\Phi$$-oriented" and doesn't take care of the domain?

You are integrating over a domain. The integral is not even defined until you have defined the domain, and you cannot say how to integrate it until you understand the domain well enough to compute the integral over it. How can you possibly even contemplate a method that doesn't "take care of" the domain?

Some useful things you can do are:

Make sure $$\Phi:(u,v,w)\rightarrow(x,y,z)$$ is a function. It helps if you can define the function using only expressions like $$x = \ldots,$$ $$y = \ldots,$$ $$z = \ldots,$$ with a well-defined, uniquely specified expression on the right hand side of each $$=$$ sign. You must still ensure that the right-hand side is defined for every point in the domain.

If you cannot figure out how to do this, but can only see how to define a variable implicitly (as in $$xy = u,$$ $$\frac xy = v$$), then you must take the extra trouble to disentangle all the possible ambiguities to ensure that you have a function. And splitting the domain is usually a good way to do this.

If you transform to a single integral, make sure $$\Phi$$ is injective. This is after you ensure that $$\Phi$$ is a function, of course.

If you divide the domain in pieces, you only need to be sure you have an injective function $$\Phi$$ on each part. The integrands you get might not match in the end, and you might not be able to put them back together in a single integral. This is not a problem; just solve each integral individually and add the results.