What constitutes plagiarism when writing a textbook? Heyall, just asking a question out of curiousity. 

I'm a mathematics undergraduate, who likes to write quite detailed notes from textbooks as a method of revising. These notes tend to follow roughly the structure of the textbook chapters - with the same definitions, theorems, etc - but often with differing proofs and exposition. I've been told by classmates that these notes are quite useful for them for revision. 

Now, I have no intention of ever turning these notes into anything other than notes - I wasn't even sure about keeping them after the exams ended - but thinking about doing so raised questions for me. 

When writing a textbook, what precisely constitutes plagiarism? 

For example, in an Abstract Algebra textbook, there are only so many ways to cover group theory - as far as I can tell, the only major differences between how several books I've seen cover group theory is in the exposition and superficially in the proofs and definitions. 

If a mathematician was annoyed that the only textbook in his/her subfield was notoriously low on detail, and wrote a book that was very similar - with the exception that it were an easier read - would that constitute plagiarism? (If so, that seems a bit restrictive to me.)

It cannot be that textbooks only contain original research, else few textbooks on undergraduate maths could've been written in the last one hundred years.
It's the words.
Speaking as a mathematician the formulas and calculations are all common knowledge, even if it's new to undergraduates. But the words you use to explain it need to be your own.  The style you use will uniquely identify you.  For examples check out Carl sagan's cosmos and Stephen Hawkins a brief history of time. Beautifully worded explanations of complex mathematics.