TITLE: Derivative of double integral
QUESTION [7 upvotes]: I am trying to find out what the derivative $\frac{\mathrm d}{\mathrm dx}f(x)$ of the function
$$f(x)=\int_0^{x^2}\left(\int_{a-x}^{a+x}\sin(a^2+b^2-x^2)\,\mathrm db\right)\mathrm da$$
is. Using the Leibniz rule twice, I get
$$f'(x)=-2x\int_0^{x^2}\left(\int_{a-x}^{a+x}\cos(a^2+b^2-x^2)\,\mathrm db\right)\mathrm da+2\int_0^{x^2}\cos(2a^2)\sin(2ax)\,\mathrm da+2x\int_{x^2-x}^{x^2+x}\sin(x^4-x^2+b^2)\,\mathrm db.$$
This does not look like it had an analytic expression.
Are there maybe some symmetries I did not see, or is there a better approach than the Leibniz rule to solve this?

REPLY [2 votes]: $$f(x)=\int_0^{x^2}\left(\int_{a-x}^{a+x}\sin(a^2+b^2-x^2)\,\mathrm db\right)\mathrm da$$
Maybe the best way to start something like this by letting:
$$g(x,a)=\int_{a-x}^{a+x}\sin(a^2+b^2-x^2)db$$
so that we have our problem in the form:
$$f(x)=\int_0^{x^2}g(x,a)da$$
From this we get:
$$f'(x)=2x\,g(x,x^2)+\int_0^{x^2}\partial_xg(x,a)da\tag{1}$$
Now we want to calculate what this derivative of $g(x,a)$ is:
$$\partial_xg(x,a)=\frac{d}{dx}\int_{a-x}^{a+x}\sin(a^2+b^2-x^2)db$$
where:
$$h(x,b)=\sin(a^2+b^2-x^2)\tag{2}$$
continuing from here we get:
$$\partial_xg(x,a)=h(x,a+x)+h(x,a-x)+\int_{a-x}^{a+x}\partial_xh(x,b)db\tag{3}$$
Now we need to calculate this derviative of $h(x,b):$
$$\partial_xh(x,b)=\partial_x\sin(a^2+b^2-x^2)=-2x\cos(a^2+b^2-x^2)\tag{4}$$
Now subbing $(4)$ into $(3)$ we get:
$$\partial_xg(x,a)=h(x,a+x)+h(x,a-x)+\int_{a-x}^{a+x}-2x\cos(a^2+b^2-x^2)db$$
Now we can sub this into $(1)$ to get:
$$f'(x)=2x\,g(x,x^2)+\int_0^{x^2}h(x,a+x)da+\int_0^{x^2}h(x,a-x)da-2x{\int_0^{x^2}\int_{a-x}^{a+x}\cos(a^2+b^2-x^2)dbda}\tag{5}$$
Then back-substituting $h$ and $g$ should give you the correct answer