However, are you sure that that is the right method?
To justify the "equating like parts", use the following result.
If a,b,c,d are rationals, c,d >= 0 and c is not the square of a rational, then
a+sqrt(c)=b+sqrt(d)
implies a=b and c=d.
Proof:
Note that if we either have a=b or c=d that the other equality falls out immediately, so let us assume that neither of these inequalities hold.
Then a-b=sqrt(d)-sqrt(c),
=> (a-b)(sqrt(d)+sqrt(c))=d-c
=> sqrt(d)+sqrt(c)=(d-c)/(a-b) is rational.
As sqrt(d)-sqrt(c) is also rational, this allows us to deduce that sqrt(c)=(sqrt(d)+sqrt(c))-(sqrt(d)-sqrt(c))/2 is rational, contrary to our assumptions.
Hence a=b and c=d.