<s>[INST] Experienced mathematicians simplifying messy algebra $$\frac{pa}{n}\left(p\frac{a-1}{N-1}+q\frac{b+1}{N+1}\right)+p\left(1-\frac{a}{N}\right)\left(\frac{pa}{N-1}+\frac{qb}{N+1}\right)+\frac{qb}{N}\left(p\frac{a+1}{N+1}+q\frac{b-1}{N-1}\right)+q\left(1-\frac{b}{N}\right)\left(\frac{pa}{N+1}+\frac{qb}{N-1}\right)=\frac{(p+q)(pa+qb)}{N}$$
The ways people with different experience in math simplify algebra ranges massively. It is something assumed trivial, so any techniques or tricks in doing so are only found by finding them yourself. Any googling will land you at an elementary school homepage.
As a first year, my attempt at the above simplification was to set denominators equal, which made for two pages of tedious workings. I would be very interested in hearing how people with more experience in math than myself would approach this simplification, or other daunting simplifications in general.
To prevent this question being too broad, I also asked my professor what he would do, he suggested that I "factorise groups of terms which had obvious common factors". The meaning of these words independently is obvious, but could somebody explain the better approach he is alluding to, as I can only see approaches equivalent to matching denominators?
 [/INST] $$\frac{pa}{N}\left(p\frac{a-1}{N-1}+q\frac{b+1}{N+1}\right)+p\left(1-\frac{a}{N}\right)\left(\frac{pa}{N-1}+\frac{qb}{N+1}\right)+\frac{qb}{N}\left(p\frac{a+1}{N+1}+q\frac{b-1}{N-1}\right)+q\left(1-\frac{b}{N}\right)\left(\frac{pa}{N+1}+\frac{qb}{N-1}\right)= \\
\frac{pa}{N}\left(\frac{pa}{N-1} -\frac{p}{N-1}+\frac{qb}{N+1} + \frac{q}{N+1}\right)+\left(p-\frac{pa}{N}\right)\left(\frac{pa}{N-1}+\frac{qb}{N+1}\right)+\frac{qb}{N}\left(\frac{pa}{N+1}+\frac{p}{N+1}+\frac{qb}{N-1} - \frac{q}{N-1}\right)+\left(q-\frac{qb}{N}\right)\left(\frac{pa}{N+1}+\frac{qb}{N-1}\right)$$
So what I did so far: I just broke the terms with $a+1,a-1,b+1,b-1$ in two parts,one with the letter and one with the $1$. Note that this way i can simplify the minus terms in the second and fourth parentheses with those in the first and third respectively. Which gives:
$$   \frac{pa}{N}\left(-\frac{p}{N-1}+ \frac{q}{N+1}\right)+p\left(\frac{pa}{N-1}+\frac{qb}{N+1}\right)+\frac{qb}{N}\left(+\frac{p}{N+1}- \frac{q}{N-1}\right)+q\left(\frac{pa}{N+1}+\frac{qb}{N-1}\right)$$
Now, I would like to have $\frac{1}{N}$ outside so:
$$   \frac{1}{N}\left[pa\left(-\frac{p}{N-1}+ \frac{q}{N+1}\right)+pN\left(\frac{pa}{N-1}+\frac{qb}{N+1}\right)+qb\left(+\frac{p}{N+1}- \frac{q}{N-1}\right)+qN\left(\frac{pa}{N+1}+\frac{qb}{N-1}\right)\right]$$
Now if you observe carefully you may see that the $N-1,N+1$ will go away but to make it more clear:
$$ \frac{1}{N}\left[pa\left(-\frac{p}{N-1}\right)+ pa\left(\frac{q}{N+1}\right)+pN\left(\frac{pa}{N-1}\right) +pN\left(\frac{qb}{N+1}\right)+qb\left(+\frac{p}{N+1}\right)- qb\left(\frac{q}{N-1}\right)+qN\left(\frac{pa}{N+1}\right)+qN\left(\frac{qb}{N-1}\right)\right]$$
Now pair the first term with the third and we get $p^2a$, the second with the seventh and we get $qpa$, the fourth with the fifth and we get $qpb$ and
the sixth with the eighth and we get $q^2b$. Putting it all together:
$$\frac{1}{N}(p^2a + qpa + qpb + q^2b) = \\
 \frac{1}{N}[pa(p + q) + qb(p + q)] = \\
\frac{(pa+qb)(p + q)}{N}$$
</s>