Initializing Variables:

sage: a,b,c,d,x = var('a,b,c,d,x')

Product of a Monomial and a Binomial

sage: eqn_mon_bin = a*(c+d) sage: eqn_mon_bin.expand() a*c + a*d

Product of the Sum and the Difference of Two Terms

sage: eqn_prod_sum_diff = (a+b)*(a-b) sage: eqn_prod_sum_diff.expand() a^2 - b^2

Square of a Binomial

sage: eqn_bin_sq = (a+b)^2 sage: eqn_bin_sq.expand() a^2 + 2*a*b + b^2 sage: eqn_bin_sq_diff = (a-b)^2 sage: eqn_bin_sq_diff.expand() a^2 - 2*a*b + b^2

Product of Two Binomials

sage: eqn_bin_prod = (x+a)*(x+b) sage: eqn_bin_prod.expand() a*b + a*x + b*x + x^2

Cube of Binomial

sage: eqn_bin_cube = (a+b)^3 sage: eqn_bin_cube.expand() a^3 + 3*a^2*b + 3*a*b^2 + b^3

Square of a Trinomial

sage: eqn_tri_sq = (a+b+c)^2 sage: eqn_tri_sq.expand() a^2 + 2*a*b + b^2 + 2*a*c + 2*b*c + c^2

Tools:

1. SageMathCloud

References:

1. Sage Docs – Symbolic Expressions

2. Schaum’s Outline of College Algebra