How to derive the formula of the centroid from section formula

How to derive the formula of the centroid from section formula.