In proofs/books/papers on mathematics the pronoun "we" is usually used. For example:
In order to derive the quadratic formula we first complete the square.
Or:
... we can deduce this using Euler's theorem ...
etc.
What is the history or origins of using we instead of I? Because certainly there is only the author who at that moment is actually doing anything!
In particular then is the "we" a 'royal we' or a collective pronoun?
It's collective. The author is trying to involve us in the work rather than telling us what they are doing for us. Sometimes I even write "if you complete the square you will see ..."