We see that the Atmospheric mass density is actually being graphed on what is called a “Log scale” -- it is the power of 10 in scientific notation that is being augmented in a linear fashion. So we fit y, the exponent of 10 of atmospheric mass density, with a linear function of altitude, then write the density itself -- Rho -- as 10^y:

Rho[h_]:=10^(-3*(1+h/50));
Plot[Rho[h],{h,0,150},PlotLabel->"Density of the Atmosphere",AxesLabel->{"Altitude (km)","Mass Density (g/(cm)^3)"}]

The picture above, from http://www.tesla-coil.com/images/csph.gif, illustrates what we need to do: the Earth is represented by the “+“ part; space by the “-“ part. We go out b kilometers from the center of the Earth, and find the mass of that spherical shell, of surface area 4\Pi r^2, and of thickness dh, and of mass density Rho[h]. So the produce of those gives the mass (volume times density). 

a is the radius of the Earth, which is 6371 kilometers. b is a+h, where h is the height at which we’re doing the current calculation of an infinitesimal quantity of mass.

Int=Integrate[Rho[h]*4*Pi*(h+6371)^2,{h,0,Infinity}]

Now we have to do some unit conversions: density was given in g/(cm)^3, whereas height is in km, and the mass of the Earth was given as 5.1480x10^18 kg. Do I have the conversion right?

N[Int*1000^2*100^3]

Well, we’re pretty darn close!

Finally, using Logs (base 10), I plot Log (base 10) of Rho, and the log undoes the exponential, to give a linear (well, affine) function -- the one that we expect, that goes through (0,-3), (50,-6):

Plot[Log[10,Rho[h]],{h,0,150},PlotLabel->"Log(Density) of the Atmosphere",AxesLabel->{"Altitude (km)","Power of 10 of Mass Density(g/(cm)^3)"}]