The Binomial Theorem for positive integer powers can be written:

#(a+b)^n = sum_(k=0)^n ((n),(k)) a^(n-k) b^k#

where #((n),(k)) = (n!)/(k! (n-k)!)#

Note that some people like to call the first row of Pascal's triangle the #0#th. Others like me prefer to call it the #1#st.

Counting from #1#, the #n+1#st row of Pascal's triangle consists of the numbers #((n),(0)), ((n),(1)), ... ((n), (n))#.

So rather than 'calculate' the individual coefficients for #(a+b)^n#, you can read them off from the #(n+1)#st row of Pascal's triangle...

For example, if we were calculating #(a+b)^12# then the coefficients would be #1#, #12#, #66#, #220#,..., #1#.

Typically our #a# and #b# are not plain variables, but have a multiplier, e.g. #(2a+3b)^n#. In such a case you need to multiply the binomial coefficient by a suitable multiple of the powers of #(2a)# and #(3b)#, e.g. #((n),(k)) (2a)^(n-k) (3b)^k = ((n),(k))2^(n-k)3^k a^(n-k) b^k#, etc.