No, this question is from my number theory book. I thought solving it involving number theory technique.
Based on your previous question I assume you are learning how to express quadradic numbers in a periodical continued fraction form. In order to do that it help to rationalize the denomiator of these numbers.