For finding the volume of a regular right pyramid with $n$ sided base where $n$ is even and the distance between the centre of the base and any of the vertex is $r$, I cut the solid by a plane passing through the apex of the pyramid perpendicular to the base and passing through any two opposite vertices. The cross section obtained is an isosceles triangle and the base is a polygon with $\dfrac{n}{2} + 1$ sides ($n/2 $ sides from the base polygon of pyramid and $1$ introduced due to intersection of plane). On the cartesian plane the cross section looks like $ABC$ (ignore the coordinates).
The centre of the base of the original solid (pyramid) is given by $O$ and $r = OA = OB$. Now, $ABC$ is the cross section of the solid obtained after the intersection of the original solid and the plane. So, the volume of this solid is given by the integral $$\int_0^h A(x)~dx$$ where $h$ is the height of the pyramid ($OC$ in the figure) and $A(x)$ is the area of cross sections of this solid (the one formed after intersection) as a function of $x$.
I can then multiply the integral by $2$ to get the volume of the pyramid. Now the problem is I can't find an expression for $A(x)$. I was able to get an expression for the length of perpendicular line segments from points on $BC$ (or $AC$) to the $x$- axis but I still couldn't find an expression for the area.
