To find the width of the rectangle, we can use the formula for the perimeter of a rectangle:
\[ P = 2 \times (length + width) \]
In Nya's case, we know the perimeter (P) is 24 feet and the length is 3 feet. We can substitute these values into the formula:
\[ 24 = 2 \times (3 + width) \]
First, divide both sides by 2:
\[ 12 = 3 + width \]
Next, subtract 3 from both sides to solve for the width:
\[ width = 12 - 3 \] \[ width = 9 \]
Therefore, the width of the garden needs to be 9 feet.