Tutorials › Calculus II › Density Depending on One Coordinate

Mass, Moments, and Centroids · Tutorial 482 of 998

Density Depending on One Coordinate

Use one-dimensional integrals to find the mass, first moments, and centroid of a rectangle with density varying only in the horizontal or vertical direction.

Intermediate 9 min read

What You'll Learn

  • Set up mass and first-moment integrals for a rectangular lamina.
  • Simplify the integrals when density depends only on \(x\) or only on \(y\).
  • Find the centroid coordinates from the first moments.
  • Compute exact results for linear and polynomial density functions.
  • Check centroid calculations and avoid interchanging the moments about the coordinate axes.

Why a One-Coordinate Density Simplifies the Calculation

A lamina can have different mass densities at different points. When the lamina is rectangular and its density depends only on \(x\), every point in a vertical strip has the same density. When the density depends only on \(y\), every point in a horizontal strip has the same density. This lets us reduce the mass and moment calculations to one-dimensional integrals.

The simplification is more than a shorter calculation. It also identifies a useful geometric fact: if density varies in just one direction, the centroid’s coordinate in the other direction remains at the midpoint of the rectangle’s corresponding side.

Definitions for a Rectangular Lamina

Let the rectangle occupy \(a\leq x\leq b\) and \(c\leq y\leq d\), where \(a<b\) and \(c<d\). Let \(\rho(x,y)\) be its mass density per unit area. Assume the density is integrable, nonnegative, and has positive total mass.

Definition: The mass \(m\), first moment about the \(x\)-axis \(M_x\), and first moment about the \(y\)-axis \(M_y\) are $$ m=\int_a^b\int_c^d \rho(x,y)\,dy\,dx,\qquad M_x=\int_a^b\int_c^d y\rho(x,y)\,dy\,dx,\qquad M_y=\int_a^b\int_c^d x\rho(x,y)\,dy\,dx. $$ The centroid is \((\bar{x},\bar{y})\), where $$ \bar{x}=\frac{M_y}{m},\qquad \bar{y}=\frac{M_x}{m}. $$

The subscript on a first moment names the axis about which the moment is taken. The distance used in that moment is therefore the perpendicular distance to that axis: \(y\) for the \(x\)-axis, and \(x\) for the \(y\)-axis. This is why the formulas for the centroid use \(M_y\) to find \(\bar{x}\), and \(M_x\) to find \(\bar{y}\).

Density Depending Only on \(x\)

Suppose \(\rho(x,y)=f(x)\). The density is constant along each vertical line through the rectangle, although it may vary from one vertical strip to another. Define the one-dimensional integrals $$ I_0=\int_a^b f(x)\,dx,\qquad I_1=\int_a^b x f(x)\,dx. $$ The mass and moments can then be computed from these two integrals and the rectangle’s vertical bounds.

Result: If \(\rho(x,y)=f(x)\), then $$ m=(d-c)I_0,\qquad M_y=(d-c)I_1,\qquad M_x=\frac{d^2-c^2}{2}I_0. $$ Consequently, provided \(I_0>0\), $$ \bar{x}=\frac{I_1}{I_0},\qquad \bar{y}=\frac{c+d}{2}. $$

The horizontal coordinate is a density-weighted average of \(x\). The vertical coordinate is the midpoint of the rectangle’s vertical interval, because density does not favor one height over another.

Worked Example: A Linear Density Depending on \(x\)

A rectangular lamina occupies \(0\leq x\leq 3\), \(1\leq y\leq 5\), and has density \(\rho(x,y)=2+x\). Find its mass, first moments, and centroid.

First calculate the two one-dimensional integrals: $$ I_0=\int_0^3(2+x)\,dx =\left[2x+\frac{x^2}{2}\right]_0^3 =6+\frac{9}{2} =\frac{21}{2}. $$ $$ I_1=\int_0^3x(2+x)\,dx =\int_0^3(2x+x^2)\,dx =\left[x^2+\frac{x^3}{3}\right]_0^3 =9+9=18. $$

The height of the rectangle is \(5-1=4\). Thus $$ m=4I_0=4\left(\frac{21}{2}\right)=42, \qquad M_y=4I_1=4(18)=72. $$ For the first moment about the \(x\)-axis, $$ M_x=\frac{5^2-1^2}{2}I_0 =\frac{25-1}{2}\left(\frac{21}{2}\right) =12\left(\frac{21}{2}\right)=126. $$ Therefore, $$ \bar{x}=\frac{M_y}{m}=\frac{72}{42}=\frac{12}{7}, \qquad \bar{y}=\frac{M_x}{m}=\frac{126}{42}=3. $$

Check the result by multiplying the centroid coordinates by the mass: $$ m\bar{x}=42\left(\frac{12}{7}\right)=72=M_y, \qquad m\bar{y}=42(3)=126=M_x. $$ Both calculated first moments are recovered.

Deriving the Formulas for \(x\)-Dependent Density

The simplification follows by separating the factors that depend on \(x\) from those that depend on \(y\). In each iterated integral, \(f(x)\) is constant while \(y\) ranges from \(c\) to \(d\).

1
Integrate to find the mass.
Since the density is \(f(x)\), the inner integral over \(y\) contributes the interval length \(d-c\): $$ m=\int_a^b\int_c^d f(x)\,dy\,dx =\int_a^b f(x)(d-c)\,dx =(d-c)I_0. $$
2
Find the moment about the \(y\)-axis.
The distance to the \(y\)-axis is \(x\), so $$ M_y=\int_a^b\int_c^d x f(x)\,dy\,dx =(d-c)\int_a^b x f(x)\,dx =(d-c)I_1. $$
3
Find the moment about the \(x\)-axis.
Here the distance is \(y\); integrating it across the rectangle gives $$ M_x=\int_a^b\int_c^d y f(x)\,dy\,dx =\int_a^b f(x)\left[\frac{y^2}{2}\right]_c^d dx =\frac{d^2-c^2}{2}I_0. $$
4
Divide moments by mass.
Because \(m=(d-c)I_0\), the ratios simplify: $$ \bar{x}=\frac{M_y}{m}=\frac{I_1}{I_0}, \qquad \bar{y}=\frac{M_x}{m} =\frac{d^2-c^2}{2(d-c)} =\frac{c+d}{2}. $$ The last equality uses \(d^2-c^2=(d-c)(d+c)\).

This derivation also shows exactly where the assumption about the density enters: it allows \(f(x)\) to be treated as constant during integration over \(y\). If density varied with both coordinates, that factorization would not generally be available.

A Polynomial Density Depending on \(x\)

The same formulas apply to polynomial densities. The only added work is evaluating the one-dimensional integrals \(I_0\) and \(I_1\). A polynomial density is physically appropriate on the rectangle when it is nonnegative throughout that region.

Worked Example: A Quadratic Density Depending on \(x\)

Let the rectangle be \(0\leq x\leq 2\), \(-1\leq y\leq 2\), with density \(\rho(x,y)=1+x^2\). Find its mass, first moments, and centroid.

Calculate $$ I_0=\int_0^2(1+x^2)\,dx =\left[x+\frac{x^3}{3}\right]_0^2 =2+\frac{8}{3} =\frac{14}{3}, $$ and $$ I_1=\int_0^2x(1+x^2)\,dx =\int_0^2(x+x^3)\,dx =\left[\frac{x^2}{2}+\frac{x^4}{4}\right]_0^2 =2+4=6. $$

The rectangle’s height is \(2-(-1)=3\), so $$ m=3\left(\frac{14}{3}\right)=14, \qquad M_y=3(6)=18. $$ Also, $$ M_x=\frac{2^2-(-1)^2}{2}\left(\frac{14}{3}\right) =\frac{4-1}{2}\left(\frac{14}{3}\right) =\frac{3}{2}\left(\frac{14}{3}\right)=7. $$ Hence $$ \bar{x}=\frac{18}{14}=\frac{9}{7}, \qquad \bar{y}=\frac{7}{14}=\frac{1}{2}. $$

Check: $$ m\bar{x}=14\left(\frac{9}{7}\right)=18=M_y, \qquad m\bar{y}=14\left(\frac{1}{2}\right)=7=M_x. $$ The vertical centroid coordinate is also the midpoint of \(-1\) and \(2\), namely \(\frac{1}{2}\).

Density Depending Only on \(y\)

Now suppose \(\rho(x,y)=g(y)\). The density is constant along each horizontal line. Define $$ J_0=\int_c^d g(y)\,dy,\qquad J_1=\int_c^d y g(y)\,dy. $$ In this case, the centroid’s horizontal coordinate is the midpoint of the rectangle’s horizontal interval, while the vertical coordinate is the density-weighted average of \(y\).

Result: If \(\rho(x,y)=g(y)\), then $$ m=(b-a)J_0,\qquad M_x=(b-a)J_1,\qquad M_y=\frac{b^2-a^2}{2}J_0. $$ Provided \(J_0>0\), $$ \bar{x}=\frac{a+b}{2},\qquad \bar{y}=\frac{J_1}{J_0}. $$

Worked Example: A Quadratic Density Depending on \(y\)

A rectangle occupies \(1\leq x\leq 4\), \(0\leq y\leq 2\), and has density \(\rho(x,y)=1+y^2\). Find its mass, first moments, and centroid.

First evaluate the integrals over the \(y\)-interval: $$ J_0=\int_0^2(1+y^2)\,dy =\left[y+\frac{y^3}{3}\right]_0^2 =2+\frac{8}{3} =\frac{14}{3}, $$ $$ J_1=\int_0^2y(1+y^2)\,dy =\int_0^2(y+y^3)\,dy =\left[\frac{y^2}{2}+\frac{y^4}{4}\right]_0^2 =2+4=6. $$

The width is \(4-1=3\), giving $$ m=3\left(\frac{14}{3}\right)=14, \qquad M_x=3(6)=18. $$ The other first moment is $$ M_y=\frac{4^2-1^2}{2}\left(\frac{14}{3}\right) =\frac{16-1}{2}\left(\frac{14}{3}\right) =\frac{15}{2}\left(\frac{14}{3}\right)=35. $$ Thus $$ \bar{x}=\frac{35}{14}=\frac{5}{2}, \qquad \bar{y}=\frac{18}{14}=\frac{9}{7}. $$

Check: $$ m\bar{x}=14\left(\frac{5}{2}\right)=35=M_y, \qquad m\bar{y}=14\left(\frac{9}{7}\right)=18=M_x. $$ The horizontal coordinate \(\frac{5}{2}\) is the midpoint of \(1\) and \(4\), as expected when density depends only on \(y\).

A Common Moment-Labeling Mistake

A frequent error is to use the moment about an axis to calculate the centroid coordinate with the same letter. That reverses the two centroid formulas. For the first worked example, this error would give $$ \bar{x}_{\text{wrong}}=\frac{M_x}{m}=\frac{126}{42}=3. $$ But \(M_x\) measures vertical distance from the \(x\)-axis, so it determines \(\bar{y}\), not \(\bar{x}\). The correction is $$ \bar{x}=\frac{M_y}{m}=\frac{72}{42}=\frac{12}{7}, \qquad \bar{y}=\frac{M_x}{m}=\frac{126}{42}=3. $$ The check \(m\bar{x}=M_y\) and \(m\bar{y}=M_x\) is a reliable way to catch this interchange.

There is also an important condition on the formulas: the total mass must be positive. If the density is nonnegative and has zero integral over the rectangle, then \(m=0\) and the centroid ratios are undefined. For a physical lamina with positive density over a region of positive area, the mass is positive.

Summary

For a rectangular lamina, a density depending on one coordinate reduces the mass and moment calculations to two one-dimensional integrals. If the density depends on \(x\), then \(\bar{x}\) is density-weighted and \(\bar{y}\) is the vertical midpoint. If it depends on \(y\), then \(\bar{x}\) is the horizontal midpoint and \(\bar{y}\) is density-weighted. In either case, compute both first moments using their axis definitions, divide by the positive mass, and verify that the resulting centroid reproduces those moments.

Check Your Understanding

Use the definitions and formulas to answer these questions.

  1. For a rectangle with density \(f(x)\), which one-dimensional integral determines the weighted horizontal coordinate?
  2. Why does a density depending only on \(x\) leave the centroid’s vertical coordinate at the midpoint of the rectangle?
  3. Write the mass and both first-moment formulas for density \(g(y)\) on \(a\leq x\leq b\), \(c\leq y\leq d\).
  4. A calculation gives \(m=20\), \(M_x=30\), and \(M_y=50\). What are \(\bar{x}\) and \(\bar{y}\), and what two equations check them?
  5. What prevents the centroid formulas from applying when the total mass is zero?

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon