Solve the following initial value problems.
6. $x\frac{dy}{dx} - 2y = 2x^4$, $y(2) = 8$
7. $\frac{dr}{d\theta} + r\tan\theta = \cos^2\theta$, $r(\frac{\pi}{4}) = 1$
8. $(y - \ln x)dx + (x + 1)dy = 0$, $y(1) = 10$
9. $\frac{dy}{dx} + y = f(x)$, $y(0) = 0$, where $f(x) = \begin{cases} 2, & 0 \le x < 1\\ 0, & x \ge 1 \end{cases}$