For this problem you need to consider two scenarios, (1) inside the sphere and (2) outside the sphere as separate problems.
Start with the general expression for the electric field:
E = kq/r².
We can then write that dE/dq = k/r² or dE = kdq/r²
However, we're not given q, we're given the charge density ρ. The amount of charge enclosed by a portion of the sphere is then:
qenclosed = ρ·(4/3)πr³ , since the amount of charge enclosed depends only on r ⇒
dq = (4/3)πρr²dr
Substituting into the expression for dE: dE = (k/r²)(4/3)(πρr²)dr
r² in the numerator cancels with r² in the denominator, so:
E = 4πkρ∫dr, evaluated from r = 0 to r, which leaves us with:
(a) Er = (4/3)πkρr , for r < a
for part (b) we start by noting that all of the charge Q resides inside the sphere when r > a.
Then Q = ρ·(4/3)πa³
Then for Er when r > a
E = kQ/r² which is simply the field of a point charge.
To put this back in terms of ρ and a just substitute for Q
(b) Er = 4πkρa³/3r² , r > a