What's the formula for this

(x+a)^n

were x is a variable
a is a constant
and n is some power that can change example

(x+5)^2
(x+5)^3
(x+5)^4

what's the general formula?

(x+a)^n = x^n + nx^(n-1)a + n(n-1)/2! x^(n-2)a^2 + n(n-1)n-2)/3! x^(n-3)a^3 + ... + a^n

so (x+5)^4
= x^4 + 4x^3(5) + 4(3)/2! x^2(5^2) + 4(3)(2)/3! x(5)^3 + (4)(3)(2)(1)/4! (5)^4
= x^4 + 20x^3 + 150x^2 + 500x + 625

How about trying the others.

draw a tree diagram to show all the possible outcomes of tossing a coin three times?

The formula you are looking for is the binomial expansion formula, also known as the binomial theorem. It allows you to expand expressions of the form (x+a)^n, where x is a variable, a is a constant, and n is a positive integer.

The general formula for expanding (x+a)^n is given by:

(x+a)^n = C(n,0) * x^n * a^0 + C(n,1) * x^(n-1) * a^1 + C(n,2) * x^(n-2) * a^2 + ... + C(n,r) * x^(n-r) * a^r + ... + C(n,n) * x^0 * a^n

In this formula, C(n,r) represents the binomial coefficient, which is calculated by the formula:

C(n,r) = n! / (r! * (n-r)!)

Here, "!" denotes the factorial function, which means multiplying a number by all of the positive integers less than it. For example, 5! = 5 * 4 * 3 * 2 * 1 = 120.

To expand a specific expression, such as (x+5)^2, (x+5)^3, or (x+5)^4, you can substitute the values of n, x, and a into the formula. Let's use (x+5)^2 as an example:

n = 2, x is the variable, and a = 5. Substituting these values into the formula, we get:

(x+5)^2 = C(2,0) * x^2 * 5^0 + C(2,1) * x^(2-1) * 5^1 + C(2,2) * x^0 * 5^2

Simplifying this expression, we have:

(x+5)^2 = 1 * x^2 * 1 + 2 * x^1 * 5 + 1 * 1 * 5^2

(x+5)^2 = x^2 + 10x + 25

Similarly, you can apply the same procedure for expanding expressions like (x+5)^3 and (x+5)^4 using the binomial expansion formula.