TITLE: Can I bring the variable of integration inside the integral?
QUESTION [7 upvotes]: $\def\d{\mathrm{d}}$My problem
So I have coefficient of a certain general solution of a PDE that turns out to be $$A_n  =\frac{\displaystyle \int_{0}^1 g(x)J_0(\lambda_mx)x\,\d x}{\displaystyle \int_0^1J^2_0(\lambda_m x)x\,\d x}.$$
Now the book says that when we replace $f(x)$ by $1$ we should get $$A_n=\frac{2}{\lambda_n J_1(\lambda_n)},$$ however I couldn't get there so I thought that by plagging it in the solution $$Q(x,t)=\sum_{n=0}^\infty A_nJ_0(\lambda_n x)g(t),$$ where $g(t)$ is another function I just don't write. I could maybe bring the $J_0(x\lambda_n)$ inside the integral and use some sort of orthogonality or something else.

REPLY [2 votes]: I'm going to reiterate my popular point from the comments: in calculus of functions of a single variable, we see (in the coarsest sense) two sorts of variable quantities appearing in functions: those that are internal to the operations on functions, and disappear once we complete the operation, which we call bound variables and the true variables on which the problem originally depended (which by analogy are unbound). (These names are from logic, where the thrust of the argument is that bound variables don't act like variables at all.) Bound variables essentially always turn out to be an artefact of notation in calculus, but frequently the weird conventions are useful when actually evaluating the objects, rather than speaking theoretically.
The first place one normally encounters a bound variable is in a limit. We speak of the limit of a function $f$ at a point $a$—no mention of a variable! But what we write is
$$ \lim_{x \to a} f(x). $$
We could write this as $l(f,a)$, since $l$ is a function of only these two things, but somehow the first notation feels better: we imagine, Newton-like, the point $x$ creeping towards $a$ until its ultimate value is $l(f,a)$ (which is the same as $f(a)$ if the function is continuous). But what we called this creeping point is irrelevant: $\lim_{y \to a} f(y)$ is the same thing. (One makes here a distinction with the conventions of physicists, who like to think their letters actually mean things, so $t$ is always a time, and $x$ a displacement, and so on. But it is mathematics that we are discussing.) And as you've probably noticed, this notation is universal: literally no one writes their limits with this function $l$. This is probably because quite often we need to talk about complicated combinations of functions, to which we do not wish to give a specific name, if only to avoid running out of letters (which is a constant problem in long proofs!). (Also, the more layers of naming we give to functions, the harder it is to remember what we are talking about in the first place.)
When we move up to the derivative, however, there is a common notation that doesn't carry bound variables around (and it's not Newton's notation: although $\dot{x}$ carries no bound variables, Newton's notation carries instead the baggage of a tacit assumption about parametrisation): Lagrange's notation
$$ f'(a) = \lim_{x \to a} \frac{f(x)-f(a)}{x-a}. $$
Of course, we're all huge fans of the chain rule around here, and somehow $(f \circ g)' = (f' \circ g) \cdot g' $ just doesn't have that memorable pop. On the other hand, Leibniz's notation
$$ \frac{df}{dx} $$
makes the basic statement of the chain rule accessible to anyone who can manipulate fractions, even if we know that this is an ill way to think about it. Thing is, $df/dx$ is not actually the correct notation ($f$ is a "pure" function, so doesn't actually have a dependence on $x$: what Leibniz would do is write $y=$ [some expression involving $x$s], and then $y$ does depend on $x$, so
$$ \frac{dy}{dx} $$
is a well-defined thing that gives you the function expressing the gradient of the tangent line as $x$ varies. We should write $df(x)/dx$, but this looks terrible, and isn't a "pure" function anymore: it's stuck depending on $x$. To evaluate the gradient at a point, one has to resort to the notation
$$ \frac{df}{dx}(a), $$
which again doesn't really make sense, or
$$ \left. \frac{df}{dx} \right|_{x=a}, $$
which is really beyond the pale (and sadly, survives in differential geometry texts, where the basis of $T_pM$ is often called $\partial_i \mid_p$, or worse, $\left. \frac{\partial}{\partial x_i} \right|_p$). So to be totally precise, you end up with
$$ \left.\frac{dy}{dx} \right|_{x=a} = \left.\frac{dy}{du} \right|_{u=u(a)} \left.\frac{du}{dx} \right|_{x=a}, $$
which is really no more mnemonic than the Lagrange notation.
Anyway, where was I? So the Leibniz-style derivative also contains a bound variable, but you don't normally notice (this also demonstrates what is wrong with writing $df/d2$, for example: $2$ is not a variable, so it can't be a bound variable: the bound variable cannot exist outside the expression in which it is bound.
To finally reach the point, the same is true in integration, but much more so, since the Leibnizian $\int_a^b f(x) \, dx$ dominates completely. (Newton had the rather sweet notation $\boxed{x}$ for the integral (integration being referred to as "squaring" a curve in them days), and that you've never heard of this should give you an indication of how popular that became.) The integral is, to a first approximation of a definition, the area under a curve. As Paramanand Singh's answer notes, this only depends on two things: the set over which one integrates, and the function. Hence one may write, without ambiguity,
$$ \int_a^b f. $$
But as anyone who has ever evaluated an integral knows, manipulating pure functions is much more difficult than manipulating what are essentially algebraic expressions, so
$$ \int_a^b f(x) \, dx $$
is much, much easier to work with. But once again, the $x$ inside the integral only has life and meaning inside it. Hence, while we can use the same letters for bound and unbound variables, we really shouldn't: this is why $F(y):=\int_a^b f(x,y) \, dx$ is only a function of $y$. But if we write $F(x) = \int_a^b f(x,x) \, dx$, it becomes uninterpretable: there is no way to distinguish the bound from the unbound. One has even worse problems dealing with the so-called "indefinite integral", $\int f(x) \, dx$, but this essay's already long enough!

Now, as far as the second part of your question goes, what you need to know is the following recurrence relation for the derivatives of Bessel functions:
$$ (rJ_1(r))' = rJ_0(r) $$
Hence one immediately obtains
$$ \int_0^1 rJ_0(\lambda_m r) \, dr = \frac{1}{\lambda_m} J_1(\lambda_m). $$
For the denominator, one has in addition the relation $J_0'(r) = -J_1(r) $, so one finds that
$$ \left( \frac{1}{2}r^2(J_0(r)^2 + J_1(r)^2) \right)' = rJ_0(r)^2, $$
and so
$$ \int_0^1 rJ_0(\lambda_m r)^2 \, dr = \frac{1}{2}(J_0(\lambda_m)^2 + J_1(\lambda_m)^2) = \frac{1}{2}J_1(\lambda_m)^2, $$
which will then cancel into the answer you want.