Question: A farmer picked a large basket of apples.He sold $\frac{1}{3}$ of the total apples to his first customer.Next, he gave $\frac{2}{5}$ of the remaining apples to his neighbor.Then, he used $\frac{1}{2}$ of the new remaining apples to bake pies.If he has $4$ apples left at the end, how many total apples did the farmer start with?
1. **State the problem:** A farmer starts with a total number of apples $x$. He sells $\frac{1}{3}$ of them, then gives $\frac{2}{5}$ of the remainder to his neighbor, then uses $\frac{1}{2}$ of the new remainder to bake pies, and finally has $4$ apples left. We need to find $x$.
2. **Set up the equation:**
- Apples sold to first customer: $\frac{1}{3}x$
- Remaining apples after first sale: $x - \frac{1}{3}x = \frac{2}{3}x$
3. **Give $\frac{2}{5}$ of remaining to neighbor:**
- Apples given to neighbor: $\frac{2}{5} \times \frac{2}{3}x = \frac{4}{15}x$
- Remaining apples after neighbor: $\frac{2}{3}x - \frac{4}{15}x = \frac{10}{15}x - \frac{4}{15}x = \frac{6}{15}x = \frac{2}{5}x$
4. **Use $\frac{1}{2}$ of new remainder to bake pies:**
- Apples used for pies: $\frac{1}{2} \times \frac{2}{5}x = \frac{1}{5}x$
- Remaining apples after baking: $\frac{2}{5}x - \frac{1}{5}x = \frac{1}{5}x$
5. **Final apples left:** Given as $4$, so
$$\frac{1}{5}x = 4$$
6. **Solve for $x$:**
$$x = 4 \times 5 = 20$$
7. **Answer:** The farmer started with $20$ apples.