Multivariable calculus

Double Integral of x + y Over the Unit Triangle

The double integral of x + y over the triangle bounded by x = 0, y = 0 and x + y = 1 equals 1/3. The inner integral in y collapses to (1 - x^2)/2, and integrating that from 0 to 1 gives 1/3. By symmetry, x and y each contribute 1/6.

f(x,y)=x+yf(x,y) = x + y
0101x(x+y)dydx=13\int_0^1 \int_0^{1-x} (x+y)\,dy\,dx = \frac{1}{3}

Numerically 0.333333, confirmed by quadrature on every build.

Set up the slices, then push through the algebra

The slanted edge is x+y=1x + y = 1. Solving for the top of a vertical slice gives y=1xy = 1 - x, so for xx in [0,1][0,1] the slice runs from y=0y = 0 up to y=1xy = 1-x.

01x(x+y)dy=[xy+y22]y=0y=1x=x(1x)+(1x)22\int_0^{1-x} (x+y)\,dy = \left[xy + \frac{y^2}{2}\right]_{y=0}^{y=1-x} = x(1-x) + \frac{(1-x)^2}{2}

Expand before integrating, because the xx terms cancel in a way that is easy to miss.

xx2+12x+x22=1x22x - x^2 + \frac{1 - 2x + x^2}{2} = \frac{1 - x^2}{2}
011x22dx=12(113)=13\int_0^1 \frac{1-x^2}{2}\,dx = \frac{1}{2}\left(1 - \frac{1}{3}\right) = \frac{1}{3}

The mistake: reading (1-x)^2 as 1 - x^2

Almost every wrong answer on this problem comes from the squared binomial. (1x)2=12x+x2(1-x)^2 = 1 - 2x + x^2, and the middle term is not optional. Dropping it leaves the inner value x32x2+12x - \frac{3}{2}x^2 + \frac12 and a final answer of 12\frac12 instead of 13\frac13.

You cannot catch this at the endpoints, since both versions happen to agree at x=0x = 0 and x=1x = 1. Test the middle instead. At x=12x = \frac12 the slice is 0y120 \le y \le \frac12, so the inner integral is computable by hand.

01/2(12+y)dy=14+18=38\int_0^{1/2}\left(\frac{1}{2} + y\right)\,dy = \frac{1}{4} + \frac{1}{8} = \frac{3}{8}

The correct formula gives 11/42=38\frac{1 - 1/4}{2} = \frac38. The faulty one gives 58\frac58. One interior test point separates them.

  • Expand (1x)2(1-x)^2 in full, every time.
  • Test the inner result at an interior value, not only at the ends.
  • The inner result must vanish at x=1x = 1, where the slice has zero length.

A symmetry check worth knowing

Swapping xx and yy maps this triangle onto itself, so TxdA\iint_T x\,dA and TydA\iint_T y\,dA have to be equal. Each is 16\frac16, and they must add to the answer.

TxdA=01x(1x)dx=1213=16,16+16=13\iint_T x\,dA = \int_0^1 x(1-x)\,dx = \frac{1}{2} - \frac{1}{3} = \frac{1}{6}, \qquad \frac{1}{6} + \frac{1}{6} = \frac{1}{3}

The triangle has area 12\frac12, so the average value of x+yx+y on it is 1/31/2=23\frac{1/3}{1/2} = \frac23. That agrees with the centroid, which sits at (13,13)\left(\frac13, \frac13\right), and 13+13=23\frac13 + \frac13 = \frac23.

Frequently asked questions

Why is the average not 1/2, the midpoint of the values 0 and 1?

Because those values are not spread evenly over the triangle. The level set x+y=cx + y = c is a segment of length c2c\sqrt{2} inside the region, so larger values of x+yx+y occupy more area. Weighting by that length gives 01c2dc01cdc=23\frac{\int_0^1 c^2\,dc}{\int_0^1 c\,dc} = \frac{2}{3}.

Can I do this integral in the order dx dy?

Yes, and by symmetry the setup is the mirror image: 0101y(x+y)dxdy\int_0^1 \int_0^{1-y} (x+y)\,dx\,dy, which again gives 13\frac13. Neither order is harder here, because the region and the integrand are both symmetric in xx and yy.