My derivation/intuition:
For four weighted boxes $B1, B2, B3, B4$, placed on a massless flat lever with a pivot at position $p$, the sum of distances to $p$ times weight, must be $0$ for the lever to be balanced. If we restrict movement on the lever along the x-axis, and denote the positions of the boxes as $x_{B1}, x_{B2}, x_{B3}, x_{B4},$ and the masses as $m_{B1}, m_{B2}, m_{B3}, m_{B4},$ we could therefore say:
$(x_{B1} - p)*m_{B1}+(x_{B2} - p)*m_{B2}+(x_{B3} - p)*m_{B3}+(x_{B4} - p)*m_{B4}=0$
This concept could be generalized to any $n$ amount of point masses restricted to movement along $x$. If we then solve for $p$ we get:
$x_{c.o.m} = p = \frac{\sum_{i=1}^{n}m_ix_i}{\sum_{i=1}^{n}m_i} $
On KhanAcademy, i read that to find the x position of the center of mass on a 2D massless plate with point masses, we do exactly the same thing. The argument being, that an object (3,2) away from the center of mass, doesn't have more "x-rotation power" than an object (3,6) away. While this is vague, it feels intuitive enough for me to accept it.
It would mean that to find the center of mass on a lamina, i should add up all the mass times positions, for every single point. I could imagine this as taking "slices" that move along only x.Then one could add up $\sum_{i=1}^{n}m_ix_i$ for each slice as a function of y, at every value of y in the region. Since the mass at every single point is rarely given, but instead the density, $p(x,y)$, i could write mass as $p(x,y)*dA$. This would allow me to create for $\sum_{i=1}^{n}m_ix_i$ the double integral:
$\int_{R}^{}(\int_{}^{}x*P(x,y)dx)dy$
Doing something similair for $\sum_{i=1}^{n}m_i$ and putting it back into the original formula, i get:
$\frac{\int_{R}^{}(\int_{}^{}x*P(x,y)dx)dy}{\int_{R}^{}(\int_{}^{}P(x,y)dx)dy}$
Wich could be simplified to:
$\frac{\int_{R}^{}(\int_{}^{}x*P(x,y)dx)dy}{total mass}$
My doubts and difficulties with the formula:
First of all this doesn't always seem to be the correct formula, such as in this video https://www.youtube.com/watch?v=WNZ8vMgaPgg by proffesor leonard, where we don't divide by the total mass, and for the x center of mass, the inner integral is timed by $y$ instead. Secondly, how could we use this in real world applications? We only care about the shape and density distribution of an object, not where it would be placed on an imaginary coordinate system. Wouldn't we be able to find a whole family of density-distribution functions that all had the same values in a shape, but different positions on the XY plane? Wich would be the right one? Any help is appreciated, sorry for the long question.