To find the width of the rectangular garden, we can use the formula for the perimeter of a rectangle, which is given by:
\[ P = 2L + 2W \]
where \( P \) is the perimeter, \( L \) is the length, and \( W \) is the width.
Nya has 24 feet of fencing for her garden, and the length \( L \) is given as 3 feet. We can substitute these values into the formula:
\[ 24 = 2(3) + 2W \]
Now, simplify the equation:
\[ 24 = 6 + 2W \]
Subtract 6 from both sides:
\[ 24 - 6 = 2W \]
\[ 18 = 2W \]
Now divide both sides by 2 to find \( W \):
\[ W = \frac{18}{2} = 9 \]
Thus, the width of the garden needs to be 9 feet.