The idea of this problem is that you need to use the fact that the gravitational acceleration, g, decreases as you move away from the surface and as you move towards the center of the planet.
At the surface, the gravitational acceleration is given by this equation
g = G * M/r^2, where
r - the radius of the Earth;
At a distance equal to h above the surface, the gravitational acceleration will be
g_h = G * M/(r + h)^2
The trick here is to divide this value by the value of g at the surface
g_h/g = (cancel(G) * cancel(M)/(r + h)^2)/(cancel(G) * cancel(M)/(r ^2)
g_h/g = r^2/(r + h)^2
Now, when h is much smaller than r, you can write this expression like this
g_h/g = [(r + h)^2/r^2]^(-1) = [((r + h))/r]^(-2) = (1 + h/r)^(-2)
Use binomial expansion to write this as
(1+h/r)^(-2) = 1 + (-2) * h/r + ((-2) * (-3))/(2!) * (h/r)^2 + ((-2) * (-3) * (-4))/(3!) * (h/r)^3 + ...
(1 + h/r)^(-2) = 1 - (2h)/r + 3(h/r)^2 - 4(h/r)^3 + ...
Since h is much smaller than r, you can approximate this to be equal to
(1 + h/r)^(-2) ~~ 1 - (2h)/r
The gravitational acceleration at a height h above sea level will thus be
g_h = g * [1-(2h)/r] " "color(blue)((1))
At a distance d below the surface, the gravitational acceleration will be
g_d = G * M_d/(r - d)^2, where
M_d - the mass of the Earth that actually attracts the body.
SInce you're below the surface, not all the mass of the Earth will contribute to the value of g_d. This happens because your object is now attracted by a sphere that has a smaller radius, i.e. (r-d).
Assuming that Earth's density is constant, you can write
rho = M/V => M = rho * V
M_d = rho * underbrace(4/3pi * (r-d)^3)_(color(green)("volume of a sphere"))
This means that g_d will be equal to
g_d = G * (rho * 4/3pi (r-d)^cancel(3))/cancel((r-d)^2) = G * 4/3pi * rho * (r-d)
Once again, divide this by the value of g at the surface to get
g = G * M/r^2 = G * (rho * 4/3pi * r^(cancel(3)))/cancel(r^2) = G * 4/3pi * rho * r
g_d/g = (cancel(G * 4/3 pi * rho) * (r-d))/(cancel(G * 4/3pi * rho) * r) = (r-d)/r = 1 - d/r
The gravitational acceleration at a distance d below the surface will thus be
g_d = g * (1 - d/r) " "color(blue)((2))
Now all you have to do is set these two equations equal to each other and solve for h
color(blue)((1) = (2)) => g_h = g_d
cancel(g) * (1 - (2h)/r) = cancel(g) * (1 - d/r)
This is equivalent to
(2h)/cancel(r) = d/cancel(r) => h = d/2
In your case, d is equal to 10 km, therefore
h = "10 km"/2 = color(green)("5 km")