# Below are the algebraic laws of addition and multiplication:

# Commutative Laws

# a+b=b+a

# a*b=b*a

# Distributive Law

# a*(b+c)=a*b+a*c

# How do you multiply polynomials?

# Take (a*x²+b*x+c)*(x+d) = (a*x²+b*x+c)*x+(a*x²+b*x+c)*d = a*x³+b*x²+c*x+a*d*x²+b*d*x+c*d= a*x³+(b+a*d)*x²+(c+b*d)*x+c*d

# Some algebraic formulas

# 1. a²-b²=(a+b)*(a-b)

# 2. (a+b)²=a²+2*a*b+b²

# 3. (a-b)²=a²-2*a*b+b²

# 4. A^(mn)= (A^m)^n

# 5. A^(m+n)= (A^m)*A^n

# 6. A^(-m) = (1/A^m)

# Quadratic Equation

# Here we will be deriving the general solution to equations of the form Ax²+Bx+C= O where A,B, and C are real number (positive or negative non-zero) coefficients.

# A less abstract example equation is 3x²+5x+10=O

# This equation is of the second order (x^2) in x.

# In order to solve for x, we need an expression that is first order in x, (x^1), or x= constant. If like a surgeon doing an operation we could somehow take the square root of both sides of Ax²+Bx= -C, we might obtain the desired first order equation in x. Trying to take into account the Bx term would seem to be a problem. Suppose, however, we create a perfect square on the left hand side of the equation in X^2;

# Ax²+Bx+C=O

# X²+Bx/A= -C/A (Dividing by A and subtracting C/A from both sides)

# X²+Bx/A+B²/4A²= B²/4A²-C/A (complete the square)

# Verify that X²+Bx/A+B²/4A²= (x+B/2A)²

# Note that we have a perfect square on the left and a constant on the right.

# (X+ B/2A)² = B²/4A² – C/A.

# Performing the square root:

# x+B/2A = ∓√(B²/4A² – C/A) x= -B/2A ∓ √(B²/4A² – C/A)

# OR

# x= -B/2A ∓ √(B²-4AC)/2A

# (Note: there are two roots)

# Note that the quantity under the radical must be > or = to 0 in order for two real roots to exist.

# If B²- 4AC is less than O, we would be attempting to take the square root of a negative number, which is known as an imaginary number.

# These conclusions come from the fact that there are no negative real numbers that have real number roots.

# Example:

# √-4= ? 2² = (-2)² = 4, Never -4

# let i=(-1)^(1/2) a unit imaginary number. Then (-4)^(1/2)=2i

# New derivation of quadratic formula:

# Ax²+Bx+C= y

# A,B,C real and neq zero

# D= B²-4AC

# Interested in the case where equation has complex roots and X is taken to be complex.

# Let X= P+IQ Y= R+IS I=(-1^(1/2))

# Y= A(P+IQ)² + B(P+IQ) + C = R+IS

# A(P²+ 2IPQ -Q²) + BP+IBQ+C = R+IS

# A(P²-Q²)+ BP+C= R and 2IAPQ+ IBQ = IS

# AP²+BP+C – AQ²= R and Q(2AP+B) = S

# Let S= O. Y is real. X is complex. P,Q,R,S are real.

# Therefore Q not equal zero since x complex then 2AP+B= O and P therefore equals real part of X which always equals -B/2A when X complex and Y real.

# P= -B/2A

# A(-B/2A)²+B(-B/2A)+C- AQ²=R = Y (S=O)

# AB²/4A²-B²/2A+C-AQ²=R

# B²/4A-2B²/4A+C-AQ²=R

# B²-4AC+4A²Q²= -4AR

# D/4A+AQ²=-R

# Y=R= -AQ²-D/4A

# Lets find the roots of the quadratic for X complex; – AQ²-D/4A=O AQ²=-D/4A Q=±√(-D)/2A Since Q real, D<O.

# Therefore X=-B/2A±I√(-D)/2A, and X=-B/2A+-(D)^(1/2)/2A and we have proved the quadratic formula for the case D<O.

# The Factorable Cubic Equation

# A cubic equation is in general of the form:

# 1.) Ax³+Bx²+Cx+D= O.

# To be factorable and have integer real roots, the equation must be expressible as

# 2.) (x-p)(x-q)(x-r) = O. The solutions or roots of the equation are p,q,r since plugging in x=p, x=q, and x=r will make the expression zero. p-p =0, q-q =0, r-r =0 and any real number times zero is zero.

# Lets work with #2 up above:

# (x-p)(x-q)(x-r) =0

# (x²-px-qx+pq)(x-r) =0

# (x²-(p+q)x+pq)(x-r) =0

# x³- (p+q)x²+ pqx – rx²+r(p+q)x -pqr =0

# x³ – (p+q+r)x²+ (pq+rp+rq)x- pqr =0

# This to x³+Bx²/A+CX/A+D/A =0 and we get

# A’= 1

# B’=B/A=- (p+q+r)

# C’= C/A=(pq+rp+rq)

# D’=D/A=- pqr

# This result leads to a simple method for solving such cubics.

# x³ – (sum of the roots) x² + (sum of product pair of roots) x- (product of the roots) = 0

# EXAMPLE: Solve the equation x³ – 9x²+ 23x-15= 0

# We begin by factoring 15; 15= 1*3*5, -1*-3*5, -1*3*-5. The factors of 15 are 1,3,5,15 and the suitable factors -1,-3, 5 or -1,-3,-5 or 1,-3,-5 and 15.

# What 3 factors 15 add up to 9? 1+3+5= 9.

# What of the product? 1*3*5=15

# We have the solution!

# (x-1)(x-3)(x-5) =0

# (x²-4x+3)(x-5) =0

# x³ – 4x² + 3x – 5x² + 20x-15 = 0

**X^3-9x^2+23X-15=0**