Integrating a square's perimeter to get its area I am trying to wrap my head around some integration applications.
I went through the exercise of integrating the circumference of a circle, $2*\pi*r$, to get the area of a circle.  I simply used the power rule and get $\pi*r^2$.
However when I extend this to a square,  I calculate the length around a square via $4*L$.  However using the power rule I end up with $2*L^2$ which is not the 
 A: Consider a square such that the distance from the centre to any side is $r$. Then the area of the square is $4r^2$, and the perimeter of the square is $8r$, which is the derivative of $4r^2$. 
So your circle rule works for the square, if we use the right parameter to describe its size.
Exploration: Let us play the same game with an equilateral triangle $T$. Again use as parameter $r$ the distance from the centre of $T$ to a side. Drop a perpendicular from the centre to a side, and join the centre to a vertex on that side. We get a $30$-$60$-$90$ triangle. Using this triangle we find that the perimeter of $T$ is $6\sqrt{3}r$, and its area is $3\sqrt{3}r^2$. Again the derivative of area is the perimeter.
The same pattern holds for all regular polygons. I will leave it to you to write out the argument, either by scaling (better) or by computation.
A: The length of a side, $L$, is analogous to the diameter of a circle, not its radius.  So the appropriate variable to use is $\ell=L/2$, in which case the perimeter is $8\ell$, which integrates to $4\ell^2$, and that is correct, since $4\ell^2=(2\ell)^2=L^2$.
(Remark:  I posted this before reading Andre Nicolas's answer.  It's basically the same.  But maybe the first sentence here is helpful.)
