Answer: 5+i
Another accepted answer is -5-i, but if your teacher wants only one answer, then I'd go for 5+i
======================================================
Work Shown:

Equating terms, we have this system

Solve the second equation for b to get b = 5/a
Plug that into the first equation to solve for 'a'

Setting each factor equal to zero would lead to...
- a-5 = 0 solves to a = 5
- a+5 = 0 solves to a = -5
- a^2+1 = 0 solves to a = i and a = -i
We're told that 'a' is a real number, so we ignore the solutions "a = i and a = -i". The only possible solutions are a = 5 and a = -5
If a = 5, then,
b = 5/a = 5/5 = 1
So

or in short,

-----------------
If a = -5, then b = 5/a = 5/(-5) = -1
So it's very possible that we could also say

If you wanted to combine the two we would use the plus/minus notation like so

This is due to (5+i)^2 and (-5-i)^2 both having the same result of 24+10i. Hence the plus/minus. If your teacher wants one answer only, then I'd go for 5+i, as we could consider it a "principal" square root in a sense.