Cut the eggs into 6 equal units (sixths). Broke = 1 unit, left = $$\frac{1}{2}$$ = 3 units, so the 18 he gave away fill the other 2 units.

[[model:questions/solutions/q5322.png]]

• Gave away → 6 − 1 (broke) − 3 (left) = 2 units
• 2 units → 18 eggs
• 1 unit → 18 ÷ 2 = 9 eggs
• Total → 6 units = 6 × 9 = 54 eggs

He bought 54 eggs.
Check: broke 9 + gave 18 + left 27 = 54; 27 = $$\frac{1}{2}$$ of 54. ✓