The US flag is called the star-spangled banner. It has a field with 13 stripes: "red, white, red, …" And a blue canton with 50 stars.
We start with a red background.
We make a single white stripe. For convenience we make it 20 pixels wide.
We reuse the stripe five more times spacing them 40 pixels apart.
But now the result is too big for the flag. 13 x 20 pixels is 260 pixels. Our flag should only be 200 pixels. So we scale the stripes in the y-direction by a factor of 200 / 260 ≈ 0.7…
We need stars
Now let's make the canton. It has a blue background.
Put a single star in the corner
Re-use the star 5 times to get a row
Re-use the row 4 times to get 30 stars.
Re-use the first star shifted by half in each direction
Re-use the shifted star 4 times to get a row, then re-use the row 3 times to get another 20 stars
Shrink the canton to fit. The vertical must be equal to the width of 7 stripes.
Add the canton to the flag