Multivariable calculus
Double Integral of x e^(xy) Over [0,1] by [0,2]
The double integral of x times e to the xy over the rectangle x from 0 to 1 and y from 0 to 2 equals (e squared minus 3) divided by 2, about 2.19453. Integrate in y first: the factor x is exactly the derivative the substitution needs, so the inner integral is e to the 2x minus 1.
Numerically 2.194528, confirmed by quadrature on every build.
Pick the order that avoids integration by parts
With frozen, . The integrand is already an exact derivative in , so the inner integral needs no work at all.
Numerically that is about 2.19453. The lower limit contributes the from , which is easy to lose.
What the other order costs
Integrating in first means with frozen, and now the factor is not the derivative of the exponent. That needs integration by parts.
That function is fine on and has a removable discontinuity at , where the limit is . Integrating it from 0 to 2 does return 2.19453, so the order is a choice about labour rather than about correctness.
The rule of thumb: look for the variable whose differential the extra factor already matches. Here pairs with , so integrate in first.
The mistake: dividing by the wrong variable
The antiderivative of with respect to is : you divide by . Dividing by instead produces , whose derivative is not the integrand.
- Integrating in , divide by .
- Integrating in , divide by .
- Here the leading cancels that exactly, which is what makes this order clean.
No division by zero sneaks in at . The cancellation happens before the division, and the inner result is simply 0 there, matching an integrand that is 0 along that whole edge.
Frequently asked questions
How do I know to integrate in y first?
Look at the loose factor. Here it is , and , so is exactly what the substitution consumes. Integrating in first leaves unmatched and forces integration by parts.
What happens at x = 0, where the antiderivative has a 1/x in it?
Nothing goes wrong. The factor in front cancels the before the limits are applied, leaving . At the inner integral is , which matches an integrand of 0 along that edge.