Let b be the side of the pyramid base (6 metres) and h be the height of the pyramid (10 metres).

Any horizontal slice through the pyramid will produce a square with side

b(h-z)/h where z is the height above the bottom.

The density is proportional to the distance x from the apex so:-

density = a times x but note that x = h-z

density= a(h-z)

so the mass of a square at a height z above the bottom is its area (side times side) times the density at that level times dz

dm = [b(h-z)/h]**2 times a(h-z) times dz

Mass is integral from z=0 to z=h of

(a*b**2/h**2) (h-z)**3 dz

Which I assume you can do