I Differentiation and Integration cannot always be swapped

AI Thread Summary
The discussion revolves around the function f(x,y) defined piecewise, which exhibits infinite discontinuity at (x,0), leading to divergence in the integral ∫f(x,y)dy for y=0. The participants explore the conditions under which differentiation and integration can be interchanged, ultimately finding that for certain functions, the left-hand side of the condition can diverge while the right-hand side converges to zero. A key example discussed is f(x,y) = x|x|g(xy), where g(t) = exp(-t^2), demonstrating that both sides can differ at x=0 despite being equal for x≠0. The conversation highlights the complexities of handling discontinuities and the subtleties in integration by substitution, culminating in a deeper understanding of the conditions for differentiation and integration in this context.
Delta2
Homework Helper
Insights Author
Messages
6,002
Reaction score
2,628
Well here is my (I hope successful this time ) attempt at 10. e)

We consider the function ##f(x,y)=\begin{cases}\dfrac{e^{-x|y|}}{y}, y\neq 0 \\ 0, y=0\end{cases}##.

For this function for ##y\neq 0## it is for any ##x##, ##\frac{\partial f}{\partial x}=-\frac{|y|}{y}e^{-x|y|}##.

Also it should be clear that due to the infinite discontinuity at the points ##(x,0)## the integral ##\int_\mathbb{R}f(x,y)dy## does not converge hence the left hand side of the condition of 10. e) is infinite (or undefined).

The right hand side of the condition is ##\int_\mathbb{R}-\frac{|y|}{y}e^{-x|y|}dy=\int_{-\infty}^0e^{xy}dy+\int_0^{+\infty} -e^{-xy} dy=0## ,

So the condition is true for this ##f##.
 
Last edited:
Mathematics news on Phys.org
Delta2 said:
Well here is my (I hope successful this time ) attempt at 10. e)

We consider the function ##f(x,y)=\begin{cases}\dfrac{e^{-x|y|}}{y}, y\neq 0 \\ 0, y=0\end{cases}##. For this function for ##y\neq 0## it is for any ##x##, ##\frac{\partial f}{\partial x}=\frac{|y|}{y}e^{-x|y|}##.

Also it should be clear that due to the infinite discontinuity at the points ##(x,0)## the integral ##\int_\mathbb{R}f(x,y)dy## does not converge hence the left hand side of the condition of 10. e) is infinite (or undefined).

The right hand side of the condition is ##\int_\mathbb{R}\frac{|y|}{y}e^{-x|y|}dy=\int_{-\infty}^0-e^{xy}dy+\int_0^{+\infty} e^{-xy} dy=0## ,

So the condition is true for this ##f##.
I was looking for finite values, i.e. existing integrals.

Edit:

However it suffices that the two sides differ at a point, where the differentials are evaluated. This would make the functions different. Your idea was good. My example also works with ##g\, : \,t \longmapsto \exp (-t^2)## and ##g(xy)##. But instead of dividing by ##y##, I multiplied by ##x## which avoids singularities.
 
Last edited:
  • Like
Likes Delta2
Ok well, I see so you looking for an example where both sides converge. ok understood.
 
Delta2 said:
Ok well, I see so you looking for an example where both sides converge. ok understood.
See my edit. You have almost the right function.
 
  • Like
Likes Delta2
Interesting, my original line of thinking is that f should have some discontinuities in order for the two sides to be different. So you saying there is some f that is continuous in R yet the two sides are different?

Hmmmm,, trying to follow your hint.. does the function ##f(x,y)=xe^{-x|y|}## does the job?
 
fresh_42 said:
I don't see what your absolute value of ##y## is good for. I had a slightly different function, such that differentiation will leave me a factor ##x## to make it zero at ##x=0##.

Er but the integral on the left hand side will not converge if I don't put |y|...

But let me ask you directly, is your function continuous everywhere in R?
 
If I understood well, your "main" function is ##f(x,y)=xe^{-x^2y^2}## but is that all, you haven't defined any special discontinuities?
 
Delta2 said:
If I understood well, your "main" function is ##f(x,y)=xe^{-x^2y^2}## but is that all, you haven't defined any special discontinuities?
I first consider ##t \longrightarrow \exp(-t^2)## and calculated the integral. Then I used a continuously differentiable function ##f\, : \,(x,y) \longmapsto h(x)g(xy)## to calculate both sides. If you want to follow this path, find ##h(x)## and do the computations! The latter is part of the question, so wordings like "Also it should be clear that" aren't especially helpful.
 
ok so for 10. e) I will follow the suggestion of @fresh_42 .

First let's consider the function ##g(t)=e^{-t^2}## and the integral ##\int_{\mathbb{R}} g(t)dt=\int_{\mathbb{R}} e^{-t^2} dt=\sqrt \pi##

Next we consider the function ##f(x,y)=xg(xy)=xe^{-x^2y^2}##

Then ##\int_{\mathbb{R}} f(x,y)dy=\int xg(xy)dy##, integration by substitution ##t=xy\Rightarrow dt=xdy## so we get that (for ##x\neq 0##)
##\int_{\mathbb{R}} f(x,y)dy=\int xg(xy)dy=\int g(t)dt=\sqrt\pi##, and the derivative of this with respect to x is zero, so the LHS of the condition is 0. (For ##x=0## this integral is 0).

For the RHS of the condition we first note that ##\frac{\partial f}{\partial x}=g(xy)-2x^2y^2g(xy)##, and integrating w.r.t y we get (for ##x\neq 0##)
##\int_{\mathbb{R}}\frac{\partial f}{\partial x}dy=\int_{\mathbb{R}} g(xy) dy-2 \int_{\mathbb{R}}x^2y^2g(xy)dy=\frac{\sqrt\pi}{x}-2x^2\frac{\sqrt\pi}{2x^3}##. This is also zero. (For ##x=0## this integral is ##\int_{\mathbb{R}}(g(0y)-0)dy=+\infty##).

Well it seems that again I am stumbled upon a non convergence, hmmm, are you sure @fresh_42 that there is function such that both sides converge (for any ##x##) yet they differ?
 
Last edited:
  • #10
Delta2 said:
ok so for 10. e) I will follow the suggestion of @fresh_42 .
That wasn't my suggestion! My suggestion is ##f(x,y)=x|x|g(xy)## with ##g(t)=\exp(-t^2)## which leads to
$$
\sqrt{\pi}=\left.\dfrac{d}{dx}\right|_{x=0} F(x)=\left.\dfrac{d}{dx}\right|_{x=0}\int_\mathbb{R}f(x,y)\,dy \neq \int_\mathbb{R}\left.\dfrac{\partial}{\partial x}\right|_{x=0}f(x,y)\,dy =0
$$
 
Last edited:
  • #11
fresh_42 said:
That wasn't my suggestion! My suggestion is ##f(x,y)=x|x|g(xy)## with ##g(t)=\exp(-t^2)## which leads to
$$
\sqrt{\pi}=\left.\dfrac{d}{dx}\right|_{x=0} F(x)=\left.\dfrac{d}{dx}\right|_{x=0}\int_\mathbb{R}f(x,y)\,dy \neq \int_\mathbb{R}\left.\dfrac{\partial}{\partial x}\right|_{x=0}f(x,y)\,dx =0
$$
You mean ##dy## at the end?
I would quibble that ##f(0,y)## is not defined. I thought of making an example using Cantor functions as discussed here, but then the partial derivatives are only defined "almost everywhere", so that is not rigorous either.
 
  • #12
Keith_McClary said:
You mean ##dy## at the end?
Thanks, typo corrected. And ##f(0,y)=0\,.##
 
  • #13
Hmmm @fresh_42 , if we set ##F(x)=\int_{\mathbb{R}}f(x,y)dy## then ##F(0)=0## and

##F'(0)=\lim_{x\rightarrow 0}\frac{F(x)-F(0)}{x-0}=\lim \frac{F(x)}{x}=lim_{x\rightarrow 0} \frac{\sqrt\pi|x|}{x}## which doesn't exist...
 
  • #14
Delta2 said:
Hmmm @fresh_42 , if we set ##F(x)=\int_{\mathbb{R}}f(x,y)dy## then ##F(0)=0## and

##F'(0)=\lim_{x\rightarrow 0}\frac{F(x)-F(0)}{x-0}=\lim \frac{F(x)}{x}=lim_{x\rightarrow 0} \frac{\sqrt\pi|x|}{x}## which doesn't exist...
##F(x) =x\cdot \sqrt{\pi}## so ##F'(x)=\sqrt{\pi} ## which does exist.
 
  • #15
fresh_42 said:
##F(x) =x\cdot \sqrt{\pi}## so ##F'(x)=\sqrt{\pi} ## which does exist.

in post #89 I calculated that ##\int_{\mathbb{R}}xg(xy)=\sqrt\pi## where am I wrong there?

Are you saying that ##\int_{\mathbb{R}}|x|g(xy)=\sqrt\pi##?

In my opinion it is ##F(x)=|x|\sqrt\pi##
 
  • #16
Find an example for which
$$
\dfrac{d}{dx}\int_\mathbb{R}f(x,y)\,dy \neq \int_\mathbb{R}\dfrac{\partial}{\partial x}f(x,y)\,dy
$$
Proof:
We first define ## g(t) = \exp(-t^2) ## and show ## I:= \int_\mathbb{R} g(x)\,dx = \sqrt{\pi} \,. ##
\begin{align*}
I^2&=\left(\int_\mathbb{R}g(x)\,dx \right)\cdot \left(\int_\mathbb{R}g(y)\,dy \right)\\
&=\int_\mathbb{R}\int_\mathbb{R}g(x)g(y)\,dx\,dy\\
&=\int_\mathbb{R}\int_\mathbb{R}\exp(-x^2-y^2)\\
&=\int_0^{\infty}\int_0^{2\pi}r\exp(-r^2)\,d\varphi \,dr\\
&=2\pi \int_0^\infty r\exp(-r^2)dr\\
&=-\pi\left[\exp(-r^2) \right]_0^\infty\\
&=\pi
\end{align*}
The function ##h(x,y)=x\cdot g(xy)## is continuous, however the parameter integral ##H(x)=\int_\mathbb{R}h(x,y)\,dy## is not:
\begin{align*}
H(x)&=\int_\mathbb{R}x\cdot g(xy)\,dy\\
&=\operatorname{sgn}(x) \int_\mathbb{R}|x|\cdot g(xy)\,dy\\
&=\operatorname{sgn}(x) \int_\mathbb{R} g(t)\,dt \\
&=\operatorname{sgn}(x)\cdot \sqrt{\pi}
\end{align*}
Now let ##f\, : \,\mathbb{R}\times \mathbb{R} \longrightarrow \mathbb{R}## the continuously differentiable function ##f(x,y)=x|x|g(xy)## such that we for ##F(x)=\int_\mathbb{R}f(x,y)\,dy##
\begin{align*}
F(x)&=\int_\mathbb{R}x|x|g(xy)\,dy\\
&= x \int_\mathbb{R}|x|g(xy)\,dy\\
&=x \int_\mathbb{R}g(t)dt\\
&=x\sqrt{\pi}\quad\quad \text{ and }\\
F\,'(x)&=\sqrt{\pi}
\end{align*}
Differentiation under the integral gives us
$$
\int_\mathbb{R}\dfrac{\partial}{\partial x}f(x,y)\,dy=\int_\mathbb{R}\left(2|x|g(xy)+x|x|\dfrac{d}{dx}g(xy) \right)\,dy
$$
which vanishes at ##x=0\,.## For ##x\neq 0## we get
\begin{align*}
\int_\mathbb{R}\dfrac{\partial}{\partial x}f(x,y)\,dy&=2\int_\mathbb{R}g(t)\,dt - 2\int_\mathbb{R}t^2g(t)\,dt\\
&= 2\sqrt{\pi}-2\left(\left[-\dfrac{t}{2}\exp(-t^2)\right]_{-\infty}^{\infty} + \dfrac{1}{2}\int_\mathbb{R}g(t)\,dt \right)\\
&=\sqrt{\pi}
\end{align*}
In the end we have
$$
\sqrt{\pi}=\left.\dfrac{d}{dx}\right|_{x=0} F(x)=\left.\dfrac{d}{dx}\right|_{x=0}\int_\mathbb{R}f(x,y)\,dy \neq \int_\mathbb{R}\left.\dfrac{\partial}{\partial x}\right|_{x=0}f(x,y)\,dy =0
$$
and although both sides are identical for ##x\neq 0## they differ at ##x=0## and thus cannot be the same.
 
  • Like
Likes Delta2
  • #17
Well this is interesting, it seems that ##\int_{\mathbb{R}}|x|g(xy)=\int_{\mathbb{R}}xg(xy)=\sqrt\pi## or where am I wrong in the last equality? Where post #9 goes wrong?

quote from post #9

Then ##\int_{\mathbb{R}} f(x,y)dy=\int xg(xy)dy##, integration by substitution ##t=xy\Rightarrow dt=xdy## so we get that (for ##x\neq 0##)
##\int_{\mathbb{R}} f(x,y)dy=\int xg(xy)dy=\int g(t)dt=\sqrt\pi##
 
  • #18
The point is that we only have ##y## in ##g(xy)## as variable. This alone determines the sign of ##xy##. Therefore, ##x## is treated as a positive constant here, because in ## t \longmapsto g(t) = \exp(-t^2)## we have ##g(c\cdot t)= \exp(-c^2t^2)## and the constant factor at our variable has to be positive in ##\dfrac{d}{dy}(xy)=|x|\cdot 1\,.##
 
  • #20
Delta2 said:
Well this is interesting, it seems that ##\int_{\mathbb{R}}|x|g(xy)=\int_{\mathbb{R}}xg(xy)=\sqrt\pi## or where am I wrong in the last equality? Where post #9 goes wrong?

quote from post #9

This is just another function than mine was. And you get a quotient at the end: ##\dfrac{1}{x}\text{ or }\dfrac{|x|}{x}## which my solution avoids.
 
  • #21
I am not sure...

But can you tell me where the integration by substitution goes wrong at post #9. I used ##t=xy## and ended up with ##\int_R xg(xy)dy=\int_R g(t)dt=\sqrt\pi###...

Apparently there is a subtle mistake here, I ll try to understand it, thanks

OK I found where the mistake is. If ##x<0## and ##t=xy## then for ##y=-\infty## it is ##t=+\infty## and vice versa, so for ##x<0## it is ##\int_{-\infty}^{+\infty}xg(xy)dy=\int_{+\infty}^{-\infty}g(t) dt=-\sqrt\pi##
 
Last edited:
  • #22
Thanks all and especially @fresh_42 , the search for this counterexample was an interesting learning experience for me!
 
Back
Top