Center of mass of a pyramid For an electromagnetic exercise, I need to find the center of mass of a pyramid. The pyramid is made of a square base of lenth a and four equilateral triangles with sides that mesure a long to. This is what I came up with for the moment but something seems to be wrong, when I try with some values, the results aren't right.
The summit of the pyramid is A, the four corners of the base are BCDE, the center of mass is o and the center of the base H. I used the fact that the center of mass is the center of the sphere going through all summits of the pyramid. p is the distance between H and O.
$$CH=\frac{a*\sqrt{2}}{2}, AC^2=AH^2+HC^2 \Rightarrow AH^2=a^2-\frac{a^2}{2}=\frac{a^2}{2}$$
O is the center of mass so OA=OC
$$OC^2=p^2*\frac{a.\sqrt{2}}{2}, OA=\frac{a^2}{2}-p$$
$$OC=OA \Rightarrow OC^2=OA^2$$
$$p^2*\frac{a.\sqrt{2}}{2}=\frac{a^4}{4}-a^2p+p^2$$
$$a^2p=\frac{a^4}{4}-\frac{a.\sqrt{2}}{2}$$
$$p=\frac{a^4-a*2\sqrt{2}}{4*a^2}$$
Is there a mistake because when I replace a with a value, the result doesn't seem right.
Thanks in advance.
Image of the pyramid with all the points
 A: The center of mass of a pyramid is obtained as follows: 
1.Join the vertex with the center of mass of the base.
2.Find the point on the above segment at height $\frac{1}{4} \times $ the height of the pyramid. ( so it divides this segment in ratio $1 \colon 3$.
(So it's not at the center of the sphere in general)
A: The center of mass of a regular tetrahedron is the only center of a regular tetrahedron, i.e. the point splitting any median (line joining a vertex with the centroid of the opposite face) into two segments with lengths proportional to $\frac{1}{4},\frac{3}{4}$. By Cavalieri's principle it follows that the center of mass of half a octahedron lies at one fourth of the height relative to the square base. No integrals are really needed.
A: First let's calculate the height $h$ of the pyramid. The height of the equilateral triangle of side $a$ is $\frac{a\sqrt{3}}{2}$ so by the Pythagorean theorem we get:
$$h = \sqrt{\left(\frac{a\sqrt{3}}{2}\right)^2 - \left(\frac{a}{2}\right)^2} = \frac{a}{\sqrt2}$$
Let's place the pyramid in the Cartesian coordinate system such that the center of the square base is at $(0,0,0)$ and the vertex is at $\left(0,0,\frac{a}{\sqrt2}\right)$. Since the pyramid is symmetrical around the $z$-axis, it is clear that the center of mass will be on the $z$-axis. We just have to calculate its $z$ coordinate. Let $\overline{z}$ be the coordinate, $M$ the mass of the pyramid and $\rho$ its density.
We have 
$$\overline{z} = \frac{1}{M}\iiint_V z\cdot\rho(x,y,z)\,dV = \frac{\rho}{M}\iiint_V z\,dV = \frac1V \iiint_V z\,dv$$
since the density $\rho$ is constant.
To integrate over the volume of the pyramid, notice that for $z \in \left[0,\frac{a}{\sqrt2}\right]$, we have to integrate over the square $\left[-\left(\frac{a}2 - \frac{z}{\sqrt2}\right), \left(\frac{a}2 - \frac{z}{\sqrt2}\right)\right]^2$. You can see this from the similarity of the triangles $\Delta(0,0,0)\left(\frac{a}{2},0,0\right)\left(0,0,\frac{a}{\sqrt2}\right)$ and $\Delta(0,0,z)\left(x,0,z\right)\left(0,0,\frac{a}{\sqrt2}\right)$ and solving for $x$ from here.
\begin{align}
\iiint_V z\,dV &= \int_0^{\frac{a}{\sqrt2}} \int_{-\left(\frac{a}2 - \frac{z}{\sqrt2}\right)}^{\left(\frac{a}2 - \frac{z}{\sqrt2}\right)} \int_{-\left(\frac{a}2 - \frac{z}{\sqrt2}\right)}^{\left(\frac{a}2 - \frac{z}{\sqrt2}\right)} z \,dxdydz\\
&= \int_0^{\frac{a}{\sqrt2}} \int_{-\left(\frac{a}2 - \frac{z}{\sqrt2}\right)}^{\left(\frac{a}2 - \frac{z}{\sqrt2}\right)} z(a-z\sqrt2) \,dydz\\
&= \int_0^{\frac{a}{\sqrt2}}  z(a-z\sqrt2)^2 \,dz\\
&= \frac{a^4}{24}
\end{align}
The volume is:
$$V = \frac{1}{3}Bh = \frac13 a^2 \cdot \frac{a}{\sqrt2} = \frac{a^3}{3\sqrt2}$$
Therefore,
$$\overline{z} = \frac1{V}\iiint_V z\,dV = \frac{a}{4\sqrt2}$$
The center of mass is at $\left(0,0,\frac{a}{4\sqrt2}\right) = \left(0,0,\frac{h}4\right)$.
