What is the general formula for these matrix coefficients? Question
I devised an interesting math puzzle for myself but couldn't deduce any solution:
Given:
$$AB=BA=A+B$$
$$ (AB)^n = \sum_{j=1}^n a_j A^j +  b_j B^j$$
It's obvious $a_j=b_j$ but what is the general formula for any given $n$? 
$$a_j=b_j = ?$$
For Example
$$ (AB)^2= A^2 + 2A + 2B + B^2 $$
or:
$$ (AB)^3= A^3 + 3A^2 + 3A + 3B + 3B^2 + B^3$$

Let's take a more general approach by evaluating $A^m B^n$.
Let $$A^m B^n=\sum_{i=1}^m {f_{i}(m,n)A^i}+\sum_{j=1}^n {g_{j}(m,n)B^j}$$
It can be seen that $f_{1}(1,n)=g_{i}(1,n)=1$ for $1\le i\le n$
By considering $A^{m+1}B^n$, one can show that: $$f_{1}(m+1,n)=\sum_{i=1}^n {g_{i}(m,n)}$$ 
$$g_{i}( m+1,n)=\sum_{j=i}^n {g_{j}(m,n)}$$
Also notice that $f_{i}(m,n)=f_{1}(m-i+1,n)$
Then by induction, $$f_{i}(m,n)=\binom{m+n-i-1}{m-i}, g_{i}(m,n)=\binom{m+n-i-1}{m-1}.$$
The answer can then be deduced by setting $m=n$.
