Using Mass and Density of a Sphere Question: A sphere of radius $R$ has total mass $M$ and density function given by $ρ = kr$, where $r$ is the distance a point lies from the centre of the sphere. Give an expression for the constant $k$ in terms of $M$ and $R$.
My Attempt: $ρ$ is defined as density, meaning $ρ=\frac{M}{Volume}$. Volume of a sphere $= \frac{4}{3}\pi R^3$. Therefore, $ρ=\frac{M}{\frac{4}{3}\pi R^3}=\frac{3M}{4\pi R^3}$. Substituting in $ρ = kr$, I am left with $$kr=\frac{3M}{4\pi R^3}$$ and therefore need to find an expression for $r$ in terms of $k$, $M$ and/or $R$, but am unsure how to continue from here.
Please help!
 A: Take a shell of infinitesimal thickness $dr$ at a distance $r$ from the centre. The mass of this shell would be
$$dM = 4\pi r^2dr \times \rho(r) = 4 \pi r^2 kr dr$$
Then integrate both sides to find the mass as a function of $k$
$$M = \int_0^R 4 \pi r^2 \cdot kr dr = 4\pi k \frac{R^4}{4}$$
Therefore, the value of k is
$$\boxed{k = \frac{M}{\pi R^4}}$$
A: If we consider a spherical shell with radius $r$ and thickness $dr$, then

Now, to find the mass of this spherical shell
\begin{align}
\text{Volume of spherical shell } &= \text{Surface area} \times \text{Thickness} \\
&= 4\pi r^{2} \cdot dr
\end{align}
Since $\rho = kr$,
\begin{align}
\text{Mass } &= \text{Volume} \times \text{Density} \\
&= 4 \pi k r^{3}dr
\end{align}
Now, to find the mass of the sphere, we integrate the above from $r=0$ to $r=R$
\begin{align}
M &= \int_{0}^{R} 4 \pi k r^{3} dr \\
&= 4 \pi k \int_{0}^{R} r^{3} dr \\
&= 4 \pi k \left[\frac{r^4}{4} \right]_{0}^{R} \\
&= \pi k R^{4}
\end{align}
Thus, an expression for the constant $k$ in terms of $M$ and $R$ is
$$k = \frac{M}{\pi R^{4}}$$
