Let $i=0.08/2=0.04$ be the semiannual interest, $n=7$ be the number of compounding periods, and $k=4$ be the number of semiannual payments made. It can be shown that the principal $P$ of the loan when the outstanding balance of the loan is $Q=\$5000$ is
$$P = \frac{1-(1+i)^{-n}}{1-(1+i)^{-(n-k)}} Q$$
With the above numbers, the principal of the loan is $P \approx \$10,814.20$.
A way to show this relation is to understand that, if $m$ is the semiannual loan payment, then the outstanding balance of the loan is given by
$$P(1+i)^k - m (1+i)^{k-1}-m (1+i)^{k-2}-\ldots-m(1+i)-m = Q$$
The semiannual payment is given by
$$m=P \frac{i}{1-(1+i)^{-n}}$$
Sum the geometrical series in the first equation and substitute the semiannual payment in the second equation and the stated result follows.
EDIT
I just wanted to add a note relative to what @Ross states, that you may simply look at this as issuing a new loan. In fact, this is quite correct, and you can see it almost instantly from the above equation, if you rewrite it as
$$P\frac{ i}{1-(1+i)^{-n}} = Q \frac{i}{1-(1+i)^{-(n-k)}}$$
Here, I multiplied both sides by $i$. What this says is that the monthly payment of the theoretical new loan with the outstanding balance and the remaining number of payments is equal to the original monthly payment. The result follows.