To solve both parts of your problem, we'll use the profit function \( P(x) = 20x - 7000 \).
Part 1: Find how many hats give a profit of $7000.
We set the profit \( P(x) \) equal to 7000:
\[ 20x - 7000 = 7000 \]
Now, we solve for \( x \):
- Add 7000 to both sides:
\[ 20x = 7000 + 7000 \]
\[ 20x = 14000 \]
- Divide both sides by 20:
\[ x = \frac{14000}{20} = 700 \]
Thus, producing and selling 700 hats will give a profit of $7000.
Part 2: Find how many hats must be produced and sold to avoid a loss.
To avoid a loss, the profit \( P(x) \) must be greater than or equal to 0:
\[ 20x - 7000 \geq 0 \]
Now, solve for \( x \):
- Add 7000 to both sides:
\[ 20x \geq 7000 \]
- Divide both sides by 20:
\[ x \geq \frac{7000}{20} = 350 \]
Thus, to avoid a loss, at least 350 hats must be produced and sold.
Final Answers:
- Part (a): 700 hats
- Part (b): 350 hats