Multivariable calculus

Double Integral of x/(1+y^2) Over a Triangle

The double integral of x/(1 + y^2) over the triangle with vertices (0,0), (2,0) and (2,1) equals pi - 2, about 1.141593. Integrating in y first gives x arctan(x/2), which then needs integration by parts. Integrating in x first is much shorter.

f(x,y)=x1+y2f(x,y) = \frac{x}{1+y^2}
020x/2x1+y2dydx=π2\int_0^2 \int_0^{x/2} \frac{x}{1+y^2}\,dy\,dx = \pi - 2

Numerically 1.141593, confirmed by quadrature on every build.

The inner integral is an arctangent

The slanted edge joins (0,0)(0,0) to (2,1)(2,1), so it is the line y=x2y = \frac{x}{2}. For fixed xx in [0,2][0,2] the vertical slice runs from y=0y = 0 to y=x2y = \frac{x}{2}, and xx is a constant throughout that step.

0x/2x1+y2dy=x[arctany]y=0y=x/2=xarctan ⁣(x2)\int_0^{x/2} \frac{x}{1+y^2}\,dy = x\left[\arctan y\right]_{y=0}^{y=x/2} = x\arctan\!\left(\frac{x}{2}\right)

The outer integral needs parts, with u=arctan ⁣(x2)u = \arctan\!\left(\frac{x}{2}\right) and dv=xdxdv = x\,dx. The derivative you need is ddxarctan ⁣(x2)=24+x2\frac{d}{dx}\arctan\!\left(\frac{x}{2}\right) = \frac{2}{4+x^2}.

02xarctan ⁣(x2)dx=[x22arctan ⁣(x2)]0202x24+x2dx\int_0^2 x\arctan\!\left(\frac{x}{2}\right)\,dx = \left[\frac{x^2}{2}\arctan\!\left(\frac{x}{2}\right)\right]_0^2 - \int_0^2 \frac{x^2}{4+x^2}\,dx
=π202(144+x2)dx=π22+π2=π2= \frac{\pi}{2} - \int_0^2\left(1 - \frac{4}{4+x^2}\right)\,dx = \frac{\pi}{2} - 2 + \frac{\pi}{2} = \pi - 2

The mistake: reaching for a logarithm

During the inner step the whole factor xx is a constant and comes straight out. The wrong move is to see a quotient, assume a logarithm, and write ln ⁣(1+y2)\ln\!\left(1+y^2\right).

These are two different integrals, and the difference is what sits in the numerator.

  • Numerator constant in yy: dy1+y2=arctany\int \frac{dy}{1+y^2} = \arctan y.
  • Numerator proportional to yy: ydy1+y2=12ln ⁣(1+y2)\int \frac{y\,dy}{1+y^2} = \frac{1}{2}\ln\!\left(1+y^2\right).
  • Both present: split the fraction into two integrals first.

The second common error is the upper limit. The hypotenuse joins (0,0)(0,0) to (2,1)(2,1), so it is y=x2y = \frac{x}{2}, not y=2xy = 2x. Using the wrong line turns arctan ⁣(x2)\arctan\!\left(\frac{x}{2}\right) into arctan(2x)\arctan(2x) and changes the answer completely.

Integrating in x first is easier

As a type 2 region the same triangle is 0y10 \le y \le 1 with xx running from the hypotenuse x=2yx = 2y across to x=2x = 2. Now the xx integral is a power rule and the leftover yy integral is standard.

012y2x1+y2dxdy=0144y22(1+y2)dy=201(21+y21)dy=π2\int_0^1 \int_{2y}^{2} \frac{x}{1+y^2}\,dx\,dy = \int_0^1 \frac{4-4y^2}{2\left(1+y^2\right)}\,dy = 2\int_0^1\left(\frac{2}{1+y^2} - 1\right)\,dy = \pi - 2

No integration by parts at all. When a region is both type 1 and type 2, spend ten seconds choosing the order before you spend ten minutes integrating.

Frequently asked questions

How do I know the hypotenuse is y = x/2?

Two vertices determine it. Through (0,0)(0,0) and (2,1)(2,1) the slope is 1020=12\frac{1-0}{2-0} = \frac12, and the line passes through the origin, so y=x2y = \frac{x}{2}. The third vertex (2,0)(2,0) lies below it, confirming the region sits between y=0y = 0 and that line.

Why does pi appear in the answer at all?

It comes from the arctangent. The upper limit x=2x = 2 makes arctan(1)=π4\arctan(1) = \frac{\pi}{4}, and that value enters twice in the final assembly, once from the boundary term of the parts formula and once from the leftover integral.