# Confused about holding variables constant during integration

• B
For a double integral, we might treat the "inner integral" separately and be able to compute something like ##\int_{x_1}^{x_2} f(x,y) dx## by holding ##y## constant during the integration. The same technique is applied in other places too, like for solving exact differential equations. I haven't come across a proper name for this (partial antiderivatives?).

However, in general this doesn't appear to be a valid strategy. If I have the equation ##4x - 3y = \frac{dy}{dx}##, and rewrite this as ##\int (4x - 3y) dx = \int dy##, I can't then just hold ##y## constant on the left when I integrate both sides since evidently I'll get the wrong answer. Some other strategy needs to be used.

So why is it only permitted in some instances to hold certain variables constant? Thanks for your help!

Mentor
2022 Award
The best way to see it, is to write the functions as what they are. If we have ##\int \int f(x,y)\,dx\,dy## then we only consider the inner integral first, and that is only a function in ##x##: ##\int f(x,y)\,dx = \int \phi(x) \,dx##.

In case of the differential equation, we have ##f(x,y)=\dfrac{dy}{dx}=\dfrac{d}{dx}(y)=(D(x))(y)## and there is no separation of the variables. You cannot write ##f(x,y)=\phi(x)## if ##y## is still a variable on both sides. It would work if it was ##f(x,y)=\dfrac{dz}{dx}##.

QuantumQuest and etotheipi
The best way to see it, is to write the functions as what they are. If we have ##\int \int f(x,y)\,dx\,dy## then we only consider the inner integral first, and that is only a function in ##x##: ##\int f(x,y)\,dx = \int \phi(x) \,dx##.

I think I can understand what you are saying from an operational perspective, but I'm still struggling on the rationale.

Why in the first instance does the function reduce to only one in ##x##; surely it's still dependent on ##y##?

Homework Helper
Gold Member
2022 Award
For a double integral, we might treat the "inner integral" separately and be able to compute something like ##\int_{x_1}^{x_2} f(x,y) dx## by holding ##y## constant during the integration. The same technique is applied in other places too, like for solving exact differential equations. I haven't come across a proper name for this (partial antiderivatives?).

However, in general this doesn't appear to be a valid strategy. If I have the equation ##4x - 3y = \frac{dy}{dx}##, and rewrite this as ##\int (4x - 3y) dx = \int dy##, I can't then just hold ##y## constant on the left when I integrate both sides since evidently I'll get the wrong answer. Some other strategy needs to be used.

So why is it only permitted in some instances to hold certain variables constant? Thanks for your help!
Note that if we have a function of two variables ##f(x, y)##, we can define:
$$g(y) = \int_{x_1}^{x_2} f(x, y)dx$$
"Keeping ##y## constant" is no different from replacing ##y## with a "constant". Compare the above with:
$$b = \int_{x_1}^{x_2} f(x, a)dx$$
This is mathematically the same thing. Choose a real number ##a##, carry out the integral, get a real number ##b##. That's a function. You can just as well write:
$$g(a) = \int_{x_1}^{x_2} f(x, a)dx$$

QuantumQuest and etotheipi
Mentor
2022 Award
I think I can understand what you are saying from an operational perspective, but I'm still struggling on the rationale.

Why in the first instance does the function reduce to only one in ##x##; surely it's still dependent on ##y##?
No, it is not within the limited context. The inner integral has ##y## only as dummy. We stripped the global context and considered only the local behavior of the inner integral. In case of ##3x-4y = y'## there is no way to separate ##y## and ## \;'\;##.

Another way to see it is the following:
From ##3x-4y=\dfrac{dy}{dx}## we get ## 3\int x\,dx - 4\int y(x)dx =\int 1\,dy## and we get the ##\int y(x)\,dx## term which doesn't vanish.

etotheipi
No, it is not within the limited context. The inner integral has ##y## only as dummy.

Ah okay, that seems important. I think that makes sense, even if it is still a little hard for me to recognise!

This is mathematically the same thing. Choose a real number ##a##, carry out the integral, get a real number ##b##. That's a function. You can just as well write:
$$g(a) = \int_{x_1}^{x_2} f(x, a)dx$$

The logic of this is clear, it's just the bit about deciding when it's safe (is that the right word...?) to hold it constant. It appears this is when the scope of that variable is limited to that one particular part. I'll need to think a little more about this to clear things up though!

Thanks for helping!

Homework Helper
Gold Member
2022 Award
@etotheipi if you have doubts about these things, you can always go back to the formal statement of integration substituition:
$$\int_{x_1}^{x_2} y'(x) g(y(x)) dx = \int_{y(x_1)}^{y(x_2)} g(y) dy$$
In this case, if ##g## is the constant function we have:
$$\int_{x_1}^{x_2} y'(x) dx = \int_{y(x_1)}^{y(x_2)} dy$$
And the assumption on which this result is based and proved is that ##y(x)## is a single-variable function of ##x##. Your initial integral isn't of that form.

etotheipi
Mentor
2022 Award
It is always a good strategy to note dependencies explicitly. E.g. in the definition of a limit we have: for every ##\varepsilon>0## there is a ##N## such that ... Better is to write: there is a ##N(\varepsilon)## such that ...

The same is true for functions. If ##f=f(x,y)## but the integral just ##\int f(x,y) dx## then the dependencies are only in the variable ##x##. The integral cannot know what you are doing with its constants elsewhere. And from the perspective of the integral, the ##dx## determines what to integrate.

QuantumQuest and etotheipi
@etotheipi if you have doubts about these things, you can always go back to the formal statement of integration substitution:

I quite like that, should be useful as a bit of a check!
It is always a good strategy to note dependencies explicitly. E.g. in the definition of a limit we have: for every ##\varepsilon>0## there is a ##N## such that ... Better is to write: there is a ##N(\varepsilon)## such that ...

The same is true for functions. If ##f=f(x,y)## but the integral just ##\int f(x,y) dx## then the dependencies are only in the variable ##x##. The integral cannot know what you are doing with its constants elsewhere. And from the perspective of the integral, the ##dx## determines what to integrate.

Funnily enough I think @PeroK has actually also told me to do this before, so it seems like a pretty good idea! I seem to have a lot of issues similar to this when dealing with functions and derivatives and whatnot with more than one variable flying around...

Last edited by a moderator:
PeroK
If ##f=f(x,y)## but the integral just ##\int f(x,y) dx## then the dependencies are only in the variable ##x##.

Also, is this only true if ##y## is not a function of ##x##? Since otherwise I might just let ##f(x,y) = y## and we already established that ##\int y(x) dx## doesn't vanish.

I wonder if this is the key part. If ##y## is just another variable with no dependence on ##x## then I can see why we can pull it out and treat it as a constant, for reasons given in the above posts; whilst if ##y## does have a dependence on ##x##, i.e. in a differential equation, we have to be a bit more careful.

Mentor
2022 Award
Also, is this only true if ##y## is not a function of ##x##? Since otherwise I might just let ##f(x,y) = y## and we already established that ##\int y(x) dx## doesn't vanish.
Right. If ##y=y(x)## then it is no longer a constant in the integral, which is a function in ##x##. Cases ##f(y(x),x))## are dealt with in the implicit function theorem, although this lays the focus on derivatives and how to separate them.
I wonder if this is the key part. If ##y## is just another variable with no dependence on ##x## then I can see why we can pull it out and treat it as a constant, for reasons given in the above posts; whilst if ##y## does have a dependence on ##x##, i.e. in a differential equation, we have to be a bit more careful.
Yes. In this case it is no longer a constant for the integral, but part of the "integration command".

etotheipi
If I have the equation ##4x - 3y = \frac{dy}{dx}##, and rewrite this as ##\int (4x - 3y) dx = \int dy##,

Why would taking an antiderivative with respect to x on the left side of an equation and taking an antiderivative with respect to y on the the right side produce an equivalent equation? It doesn't work for ##x^2 = 1##.

Homework Helper
Gold Member
2022 Award
For a double integral, we might treat the "inner integral" separately and be able to compute something like ##\int_{x_1}^{x_2} f(x,y) dx## by holding ##y## constant during the integration. The same technique is applied in other places too, like for solving exact differential equations. I haven't come across a proper name for this (partial antiderivatives?).

However, in general this doesn't appear to be a valid strategy. If I have the equation ##4x - 3y = \frac{dy}{dx}##, and rewrite this as ##\int (4x - 3y) dx = \int dy##, I can't then just hold ##y## constant on the left when I integrate both sides since evidently I'll get the wrong answer. Some other strategy needs to be used.

So why is it only permitted in some instances to hold certain variables constant? Thanks for your help!

If we have:
$$y(x) = e^{-3x} + \frac 4 3 x - \frac 4 9$$
Then:
$$4x - 3y = -3e^{-3x} + \frac 4 3$$
And:
$$\int(4x - 3y) dx = e^{-3x} + \frac 4 3 x + C = y(x) + C$$
Moreover:
$$\frac{dy}{dx} = 4x - 3y$$
Hence:
$$\int(4x - 3y) dx = \int \frac{dy}{dx} dx = \int dy = y(x) + C$$
So, as long as you are careful to treat ##y## as a function of ##x## properly this all works out.

Last edited:
Why would taking an antiderivative with respect to x on the left side of an equation and taking an antiderivative with respect to y on the the right side produce an equivalent equation? It doesn't work for ##x^2 = 1##.

I'm not too sure what you are saying; I integrated both sides with respect to ##x##.
So, as long as you are careful to treat ##y## as a function of ##x## properly this all works out.

Thanks for this, it confirms what I suspected about the distinction.

One more thing; @fresh_42 said earlier that for ##f(x,y) = \frac{dz}{dx}##, the function ##f(x,y)## becomes essentially only a function of ##x##. How is it possible to tell in this case that ##y## is not a function of ##x##? If we were to solve it we'd get a relation between ##x,y,z## and surely that would make ##y## of the form ##y(x,z)##.

Mentor
2022 Award
One more thing; @fresh_42 said earlier that for ##f(x,y) = \frac{dz}{dx},## the function ##f(x,y)## becomes essentially only a function of ##x##. How is it possible to tell in this case that ##y## is not a function of ##x##?
It isn't. The situation ##y=y(x)## has been brought into discussion by you later IIRC. What I have said there was meant for a ##y## which doesn't depend on ##x##.

etotheipi
It isn't. The situation ##y=y(x)## has been brought into discussion by you later IIRC. What I have said there was meant for a ##y## which doesn't depend on ##x##.

Ah right, sorry! I see. I think that clears everything up that I had doubts about. Thanks everyone for your help!