
We can also use Pappus' (Second) Centroid Theorem, which states that the volume of a solid of revolution is equal to the area of the region revolved about the axis of symmetry times the circumference of the circular path "swept out" by the centroid of the region,
$$ V \ = \ A \ \cdot \ 2 \pi \ \overline{r} \ \ . $$
The area of the quarter-ellipse (in the diagram for the problem) for which we wish to locate its centroid is $ \ \frac{1}{4} \cdot \pi \ ab \ $ .
If we revolve this region about the $ \ x-$ axis, we obtain a solid of revolution which is half of a "prolate spheroid", an ellipsoid with one of its semi-axes having length $ \ a \ $ and two with length $ \ b \ $ . Its volume is then $ \ \frac{1}{2} \cdot \ \frac{4 \pi}{3} \ ab^2 \ $ . The circumference of the centroid's path (in blue) is $ \ 2 \pi \cdot \ \overline{y} \ $ . By Pappus' Theorem, we conclude
$$ \frac{2 \pi}{3} \ ab^2 \ = \ \frac{\pi}{4} \ ab \ \cdot \ 2 \pi \cdot \ \overline{y} \ \ \Rightarrow \ \ \overline{y} \ = \ \frac{4}{3 \pi} \ b \ \ . $$
By similar reasoning, revolving the quarter-ellipse about the $ \ y-$ axis generates half of an "oblate spheroid" with one semi-axis of length $ \ b \ $ and two with length $ \ a \ $ ; the circumference of the centroid path (in green) is $ \ 2 \pi \cdot \ \overline{x} \ $ . Hence,
$$ \frac{2 \pi}{3} \ a^2b \ = \ \frac{\pi}{4} \ ab \ \cdot \ 2 \pi \cdot \ \overline{x} \ \ \Rightarrow \ \ \overline{x} \ = \ \frac{4}{3 \pi} \ a \ \ . $$
The Centroid Theorems have a direct connection to the moment integrals used to compute the coordinates of a centroid, although the means to describe them in this way was not available to Pappus.
Answering the question for the problem is then a matter of solving
$$ 4 \ = \ \frac{4}{3 \pi} \ a \ \ \ \text{and} \ \ \ 2 \ = \ \frac{4}{3 \pi} \ b \ \ , $$
as also shown in other posted answers here.