Key Rules:
| Rule | Math | Description |
|---|---|---|
| Product Rule | $a^m \cdot a^n = a^{m+n}$ | Same base, add exponents |
| Quotient Rule | $a^m / a^n = a^{m-n}$ | Same base, subtract exponents |
| Power Rule | $(a^m)^n = a^{mn}$ | Power of a power, multiply exponents |
| Product to Power | $(ab)^n = a^n b^n$ | Distribute exponent over multiplication |
| Quotient to Power | $(a/b)^n = a^n / b^n$ | Distribute exponent over division |
| Zero Exponent | $a^0 = 1$ | Any nonzero base to the zero power is 1 |
| Negative Exponent | $a^{-n} = \tfrac{1}{a^n}$ | Flip to denominator |
MATLAB Commands:
syms x y a b n
% Simplify an expression with integer exponents
expr = (4 * x^(-4) * y^5)^3;
simplify(expr) % Returns 64*y^15/x^12
% Expand exponents step by step
expand(expr) % Distributes the power
% Rewrite to eliminate negative exponents
rewrite(x^(-3), 'power') % Shows 1/x^3
Useful Attributes:
simplify(expr) — Applies all exponent rules automatically and returns the simplest form.expand(expr) — Distributes powers and multiplies out. Useful to see intermediate steps.rewrite(expr, 'power') — Converts between equivalent forms.a^{m} \cdot a^{n} = a^{m+n} → $a^{m} \cdot a^{n} = a^{m+n}$
\frac{a^m}{a^n} = a^{m-n} → $\frac{a^m}{a^n} = a^{m-n}$
(a^m)^n = a^{mn} → $(a^m)^n = a^{mn}$
a^{-n} = \frac{1}{a^n} → $a^{-n} = \frac{1}{a^n}$
Key Rules:
| Rule | Math | Description |
|---|---|---|
| Definition | $a^{1/n} = \sqrt[n]{a}$ | Rational exponent as a root |
| General Form | $a^{m/n} = (\sqrt[n]{a})^m = \sqrt[n]{a^m}$ | Root and power are interchangeable in order |
| All integer exponent rules still apply | — | Product, quotient, power rules work the same way |
MATLAB Commands:
syms x
% Simplify rational exponent expressions
simplify(x^(2/3) * x^(1/3)) % Returns x
% Convert between radical and exponent form
expr = x^(3/4);
pretty(expr) % Displays in readable form
% Evaluate a number with a rational exponent
eval_result = 8^(2/3); % Returns 4 (cube root of 8, then squared)
% Simplify a complex rational exponent expression
simplify((x^(1/2) * x^(3/4)) / x^(1/4)) % Returns x
a^{m/n} = \left(\sqrt[n]{a}\right)^m = \sqrt[n]{a^m} → $a^{m/n} = \left(\sqrt[n]{a}\right)^m = \sqrt[n]{a^m}$
a^{1/n} = \sqrt[n]{a} → $a^{1/n} = \sqrt[n]{a}$
Remember: denominator = root (down under the radical), numerator = power (up as the exponent).
Key Rules:
| Rule | Math | Description | ||
|---|---|---|---|---|
| Product Rule for Radicals | $\sqrt{ab} = \sqrt{a} \cdot \sqrt{b}$ | Split radical over multiplication | ||
| Quotient Rule for Radicals | $\sqrt{a/b} = \sqrt{a} / \sqrt{b}$ | Split radical over division | ||
| Simplifying | `√(a^2) = | a | ` (even root) | Even roots produce absolute value |
| Simplifying | $\sqrt[n]{a^n} = a$ (odd root) | Odd roots preserve sign | ||
| Rationalizing | Multiply by conjugate to clear radicals from denominator |
MATLAB Commands:
syms x positive % Declare x as positive to avoid absolute value issues
% Simplify radical expressions
simplify(sqrt(50)) % Returns 5*sqrt(2)
simplify(sqrt(x^4)) % Returns x^2 (since x is positive)
% Work with nth roots
simplify(x^(1/3) * (8*x^2)^(1/3)) % Cube root operations
% Rationalize a denominator manually or let simplify handle it
expr = 1 / (sqrt(x) - 1);
simplify(expr * (sqrt(x)+1) / (sqrt(x)+1)) % Rationalizes
% Use nthroot for numeric nth roots (real-valued)
nthroot(-27, 3) % Returns -3 (unlike (-27)^(1/3))
nthroot(a, n) for numeric real-valued nth roots of negative numbers. MATLAB's ^ operator may return complex results for fractional powers of negatives.\sqrt{x} → $\sqrt{x}$ · \sqrt[3]{x} → $\sqrt[3]{x}$ · \sqrt[n]{x} → $\sqrt[n]{x}$
\frac{a}{b - \sqrt{c}} \cdot \frac{b + \sqrt{c}}{b + \sqrt{c}} — rationalizing by multiplying by the conjugate.
Key Vocabulary:
3x^2)x + 5)x^2 + 3x + 1)MATLAB Commands:
syms x
% Define polynomials
p = 3*x^3 - 2*x^2 + x - 7;
q = x^2 + 4*x + 1;
% Addition
p_plus_q = p + q;
expand(p_plus_q)
% Subtraction
p_minus_q = p - q;
expand(p_minus_q)
% Multiplication
p_times_q = p * q;
expand(p_times_q) % Distributes and collects like terms
% Find the degree of a polynomial
polynomialDegree(p) % Returns 3
% Collect terms by variable
collect(p_times_q, x) % Groups by powers of x
% Special products
expand((x + 3)^2) % Returns x^2 + 6*x + 9 (perfect square)
expand((x + 3)*(x - 3)) % Returns x^2 - 9 (difference of squares)
(a+b)^2 = a^2 + 2ab + b^2 → $(a+b)^2 = a^2 + 2ab + b^2$
(a+b)(a-b) = a^2 - b^2 → $(a+b)(a-b) = a^2 - b^2$
(a+b)^3 = a^3 + 3a^2b + 3ab^2 + b^3 → $(a+b)^3 = a^3 + 3a^2b + 3ab^2 + b^3$
Key Factoring Techniques:
| Technique | Pattern | Example |
|---|---|---|
| Greatest Common Factor (GCF) | $ab + ac = a(b + c)$ | 6x^2 + 3x = 3x(2x + 1) |
| Difference of Squares | $a^2 - b^2 = (a+b)(a-b)$ | x^2 - 9 = (x+3)(x-3) |
| Perfect Square Trinomial | $a^2 + 2ab + b^2 = (a+b)^2$ | x^2 + 6x + 9 = (x+3)^2 |
| Sum of Cubes | $a^3 + b^3 = (a+b)(a^2 - ab + b^2)$ | |
| Difference of Cubes | $a^3 - b^3 = (a-b)(a^2 + ab + b^2)$ | |
| Factoring by Grouping | Group terms in pairs, factor each pair | |
| Trinomial Factoring | Find two numbers that multiply to ac and add to b |
MATLAB Commands:
syms x
% Factor a polynomial
factor(x^2 - 9) % Returns (x - 3)*(x + 3)
factor(x^2 + 6*x + 9) % Returns (x + 3)^2
factor(x^3 - 27) % Returns (x-3)*(x^2 + 3*x + 9)
factor(2*x^3 + 4*x^2 - 6*x) % Returns 2*x*(x - 1)*(x + 3)
factor(x^3 + x^2 - x - 1) % Factoring by grouping handled automatically
% Check your work — expand should give the original back
expand(factor(x^3 - 27)) % Returns x^3 - 27
% Factor over specific domains
factor(x^2 + 1) % Returns x^2 + 1 (irreducible over reals)
factor(x^2 + 1, 'FactorMode', 'complex') % Factors over complex numbers
a^2 - b^2 = (a+b)(a-b) → $a^2 - b^2 = (a+b)(a-b)$ — difference of squares
a^3 + b^3 = (a+b)(a^2 - ab + b^2) → $a^3 + b^3 = (a+b)(a^2 - ab + b^2)$ — sum of cubes
a^3 - b^3 = (a-b)(a^2 + ab + b^2) → $a^3 - b^3 = (a-b)(a^2 + ab + b^2)$ — difference of cubes
Key Operations:
MATLAB Commands:
syms x
% Simplify a rational expression
simplify((x^2 - 4) / (x^2 + 4*x + 4)) % Returns (x - 2)/(x + 2)
% Multiply rational expressions
expr = ((x + 1)/(x - 2)) * ((x - 2)/(x^2 - 1));
simplify(expr) % Returns 1/(x - 1)
% Divide rational expressions
expr = ((x^2 - 9)/(x + 1)) / ((x - 3)/(x^2 + 2*x + 1));
simplify(expr) % Simplifies fully
% Add rational expressions (MATLAB finds the LCD automatically)
expr = 1/(x - 1) + 1/(x + 1);
simplify(expr) % Returns 2*x/(x^2 - 1)
% Find the domain restrictions (where denominator = 0)
denom = x^2 + 4*x + 4;
solve(denom == 0, x) % Returns x = -2
\frac{a}{b} \cdot \frac{c}{d} = \frac{ac}{bd} → $\frac{a}{b} \cdot \frac{c}{d} = \frac{ac}{bd}$
\frac{a}{b} + \frac{c}{d} = \frac{ad + bc}{bd} → $\frac{a}{b} + \frac{c}{d} = \frac{ad + bc}{bd}$
i, where $i^2 = -1$. A complex number has the form $a + bi$ where a is the real part and b is the imaginary part.Key Operations:
| Operation | Formula | ||
|---|---|---|---|
| Addition | (a+bi) + (c+di) = (a+c) + (b+d)i |
||
| Subtraction | (a+bi) - (c+di) = (a-c) + (b-d)i |
||
| Multiplication | (a+bi)(c+di) = (ac-bd) + (ad+bc)i |
||
| Division | Multiply top and bottom by the conjugate of the denominator | ||
| Conjugate | The conjugate of a+bi is a-bi |
||
| Modulus (Magnitude) | ` | a+bi | = sqrt(a^2 + b^2)` |
MATLAB Commands:
% Numeric complex arithmetic
z1 = 3 + 4i;
z2 = 1 - 2i;
z1 + z2 % Returns 4 + 2i
z1 * z2 % Returns 11 - 2i
z1 / z2 % Divides using conjugate method
conj(z1) % Returns 3 - 4i (conjugate)
abs(z1) % Returns 5 (modulus)
real(z1) % Returns 3 (real part)
imag(z1) % Returns 4 (imaginary part)
% Symbolic complex numbers
syms a b c d
z = (a + b*1i) * (c + d*1i);
expand(z) % Expands the product
% Square root of negative numbers
sqrt(sym(-16)) % Returns 4i
1i or 1j (not just i) to avoid conflicts if i is used as a variable. In the Symbolic Toolbox, 1i is the imaginary unit.i^2 = -1 → $i^2 = -1$
z = a + bi, \quad \bar{z} = a - bi → $z = a + bi, \quad \bar{z} = a - bi$
|z| = \sqrt{a^2 + b^2} → $|z| = \sqrt{a^2 + b^2}$
MATLAB Commands:
syms x
% solve() returns the solution set
solve(x^2 - 4 == 0, x) % Returns [-2; 2]
solve(x^2 + 1 == 0, x) % Returns [-i; i] (no real solutions)
solve(0*x == 0, x) % Returns a condition (all x)
% Check if a value is a solution using subs()
eqn = x^2 - 5*x + 6;
subs(eqn, x, 2) % Returns 0 — so x=2 is a solution
subs(eqn, x, 4) % Returns 2 — not a solution
MATLAB Commands:
syms x
% Solve a linear equation
solve(3*x + 7 == 16, x) % Returns 3
% Linear equation with fractions
solve(x/3 + 2 == x/5 - 1, x) % Handles LCD automatically
% Linear equation with rational expressions
solve(2/(x-1) + 3 == 5/(x-1), x) % Check result — may be extraneous
% Show steps using simplify before solving
lhs = 2*(x + 3) - 4;
rhs = 3*x + 1;
expand(lhs) % See distributed form
solve(lhs == rhs, x)
MATLAB Commands:
syms r t d
% Distance = Rate * Time
% Example: Two cars, one at 60 mph and one at 45 mph, leave at the same
% time. When will the faster car be 30 miles ahead?
solve(60*t - 45*t == 30, t) % Returns t = 2 hours
% Work-rate: Worker A finishes in 6 hrs, Worker B in 8 hrs.
% How long working together?
syms t_together
solve(t_together/6 + t_together/8 == 1, t_together) % Returns 24/7 hours
% Mixture: How many liters of 20% solution to mix with 10 liters
% of 50% solution to get a 30% solution?
syms L
solve(0.20*L + 0.50*10 == 0.30*(L + 10), L) % Returns 20 liters
ax + b = 0 \quad \Rightarrow \quad x = -\frac{b}{a} → $ax + b = 0 \quad \Rightarrow \quad x = -\frac{b}{a}$
d = rt → $d = rt$ (distance = rate × time)
PV = nRT for T).MATLAB Commands:
syms P V n R T
% Solve for a specific variable
solve(P*V == n*R*T, T) % Returns (P*V)/(n*R)
% Solve the quadratic formula setup for x
syms a b c x
solve(a*x^2 + b*x + c == 0, x) % Returns the quadratic formula
% Solve for y in a circle equation
syms y h k r
solve((x-h)^2 + (y-k)^2 == r^2, y) % Returns k ± sqrt(r^2 - (x-h)^2)
PV = nRT \quad \Rightarrow \quad T = \frac{PV}{nR} → $PV = nRT \quad \Rightarrow \quad T = \frac{PV}{nR}$
The Quadratic Formula:
Completing the Square: Transform $ax^2 + bx + c$ into vertex form $a(x-h)^2 + k$.
MATLAB Commands:
syms x
% Solve by factoring (MATLAB factors internally)
solve(x^2 + 5*x + 6 == 0, x) % Returns [-3; -2]
% See the factored form explicitly
factor(x^2 + 5*x + 6) % Returns (x + 2)*(x + 3)
% Square root property
solve((x - 3)^2 == 16, x) % Returns [-1; 7]
solve(x^2 == 12, x) % Returns [-2*sqrt(3); 2*sqrt(3)]
MATLAB Commands:
syms x a_coeff b_coeff c_coeff
% Solve any quadratic using solve()
solve(2*x^2 - 4*x - 3 == 0, x) % Uses quadratic formula internally
% Complete the square manually
expr = x^2 + 6*x + 2;
% Rewrite: (x+3)^2 - 9 + 2 = (x+3)^2 - 7
expand((x + 3)^2 - 7) % Verify: should equal expr
% General quadratic formula result
solve(a_coeff*x^2 + b_coeff*x + c_coeff == 0, x)
% Returns (-b_coeff ± sqrt(b_coeff^2 - 4*a_coeff*c_coeff)) / (2*a_coeff)
MATLAB Commands:
syms t x
% Projectile: h(t) = -16t^2 + 64t + 80, when does it hit the ground?
h = -16*t^2 + 64*t + 80;
solutions = solve(h == 0, t);
double(solutions) % Convert to numeric, pick positive value
% Area: A rectangle is 3 ft longer than it is wide, area = 70 sq ft
syms w
solutions = solve(w * (w + 3) == 70, w);
solutions(solutions > 0) % Pick the positive width
x^4 - 5x^2 + 4 = 0 becomes u^2 - 5u + 4 = 0 if you let u = x^2.MATLAB Commands:
syms x
% MATLAB handles these directly — no manual substitution needed
solve(x^4 - 5*x^2 + 4 == 0, x) % Returns [-2, -1, 1, 2]
% Another example: x^(2/3) - 5*x^(1/3) + 6 = 0
solve(x^(2/3) - 5*x^(1/3) + 6 == 0, x)
% To see the substitution approach:
syms u
solve(u^2 - 5*u + 4 == 0, u) % u = 1 or u = 4
% Then x^2 = 1 → x = ±1, x^2 = 4 → x = ±2
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} → $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
D = b^2 - 4ac → $D = b^2 - 4ac$ (discriminant)
a(x-h)^2 + k → $a(x-h)^2 + k$ (vertex form)
MATLAB Commands:
syms x
% Solve a radical equation
solve(sqrt(x + 3) == x - 1, x)
% Always verify solutions using subs()
solutions = solve(sqrt(x + 3) == x - 1, x);
for k = 1:length(solutions)
val = solutions(k);
lhs_val = subs(sqrt(x + 3), x, val);
rhs_val = subs(x - 1, x, val);
fprintf('x = %s: LHS = %s, RHS = %s, Valid = %d\n', ...
char(val), char(simplify(lhs_val)), char(simplify(rhs_val)), ...
isequal(simplify(lhs_val), simplify(rhs_val)));
end
% Equation with two radicals
solve(sqrt(x + 5) == sqrt(2*x + 1), x)
Interval Notation:
(a, b) — open interval, excludes endpoints[a, b] — closed interval, includes endpoints(-∞, a) or (b, ∞) — extends to infinityMATLAB Commands:
syms x
% Solve a single linear inequality
solve(3*x - 7 > 2, x, 'ReturnConditions', true)
% Returns: x > 3
% Solve a double inequality (compound inequality)
solve(2 < 3*x + 1 < 10, x, 'ReturnConditions', true)
% Returns: 1/3 < x < 3
% Alternative: use the assume and conditions framework
assume(x, 'real');
solve([3*x - 7 > 2], x, 'ReturnConditions', true)
a < b \leq c → $a < b \leq c$ · x \geq 5 → $x \geq 5$ · x \neq 0 → $x \neq 0$
Intervals: (-\infty, 3] → $(-\infty, 3]$ · [a, b) → $[a, b)$
MATLAB Commands:
syms x
% Solve a polynomial inequality
solve(x^2 - 4*x + 3 > 0, x, 'ReturnConditions', true)
% x^2 - 4x + 3 = (x-1)(x-3), so solution is x < 1 or x > 3
% Find the critical points (roots) first
roots_poly = solve(x^2 - 4*x + 3 == 0, x) % Returns [1; 3]
% Visualize to verify
fplot(x^2 - 4*x + 3, [-2 5])
hold on
yline(0)
hold off
title('x^2 - 4x + 3')
MATLAB Commands:
syms x
% Solve a rational inequality
solve((x - 2)/(x + 3) >= 0, x, 'ReturnConditions', true)
% Solution: x < -3 or x >= 2
% Find critical points from numerator AND denominator
numerator_roots = solve(x - 2 == 0, x); % x = 2
denominator_roots = solve(x + 3 == 0, x); % x = -3 (excluded from domain)
|p| = b splits into two cases: p = b or p = -b (when b ≥ 0). If b < 0, there is no solution. For |p| = |q|, use p = q or p = -q.MATLAB Commands:
syms x
% Solve an absolute value equation
solve(abs(2*x - 5) == 3, x) % Returns [1; 4]
% Absolute value equals absolute value
solve(abs(x - 3) == abs(2*x + 1), x)
% No solution case
solve(abs(x + 2) == -5, x) % Returns empty — no solution
|p| < b → -b < p < b (a compound inequality — "and")|p| > b → p < -b or p > b (a disjunction — "or")MATLAB Commands:
syms x
% Less-than type: |2x - 1| < 5
solve(abs(2*x - 1) < 5, x, 'ReturnConditions', true)
% Returns -2 < x < 3
% Greater-than type: |x + 3| > 7
solve(abs(x + 3) > 7, x, 'ReturnConditions', true)
% Returns x < -10 or x > 4
|x| = \left|x\right| → $|x| = \left|x\right|$ · |x - a| < b → $|x - a| < b$
|p| < b \Rightarrow -b < p < b → $|p| < b \Rightarrow -b < p < b$ (Less thAND)
|p| > b \Rightarrow p < -b \text{ or } p > b → $|p| > b \Rightarrow p < -b \text{ or } p > b$ (GreatOR)
(x, y). The plane is divided into four quadrants. The x-intercept is where y = 0 and the y-intercept is where x = 0.MATLAB Commands:
syms x y
% Plot individual points
plot([1 -2 3 0], [4 -1 0 5], 'ro', 'MarkerSize', 10)
grid on
xlabel('x'); ylabel('y')
title('Plotting Points')
% Find intercepts of an equation
eqn = 2*x + 3*y - 6;
x_intercept = solve(subs(eqn, y, 0), x) % Set y=0, solve for x
y_intercept = solve(subs(eqn, x, 0), y) % Set x=0, solve for y
Key Forms:
| Form | Equation | When to Use |
|---|---|---|
| Slope-Intercept | $y = mx + b$ | When you know slope and y-intercept |
| Point-Slope | $y - y_1 = m(x - x_1)$ | When you know slope and a point |
| Standard Form | $Ax + By = C$ | General form for linear equations |
Slope: $m = \frac{y_2 - y_1}{x_2 - x_1}$. Parallel lines have equal slopes. Perpendicular lines have slopes that are negative reciprocals ($m_1 \cdot m_2 = -1$).
MATLAB Commands:
syms x
% Plot a line from slope-intercept form
y = 2*x + 3;
fplot(y, [-5 5])
grid on
title('y = 2x + 3')
% Calculate slope from two points
x1 = 1; y1 = 3; x2 = 4; y2 = 9;
m = (y2 - y1) / (x2 - x1); % Returns 2
% Point-slope to slope-intercept
syms m_sym x1_sym y1_sym
expand(m_sym * (x - x1_sym) + y1_sym) % Distributes to y = mx + b form
% Check if lines are parallel or perpendicular
m1 = 3; m2 = -1/3;
if m1 == m2
disp('Parallel')
elseif m1 * m2 == -1
disp('Perpendicular') % This case
else
disp('Neither')
end
% Plot multiple lines
fplot([2*x + 1, 2*x - 3, -x/2 + 4], [-5 5])
legend('y = 2x+1', 'y = 2x-3 (parallel)', 'y = -x/2+4 (perpendicular)')
grid on
y = mx + b → $y = mx + b$ (slope-intercept)
y - y_1 = m(x - x_1) → $y - y_1 = m(x - x_1)$ (point-slope)
m = \frac{y_2 - y_1}{x_2 - x_1} → $m = \frac{y_2 - y_1}{x_2 - x_1}$ (slope formula)
d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2} → $d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$ (distance)
Parallel: $m_1 = m_2$. Perpendicular: $m_1 \cdot m_2 = -1$.
r from a center (h, k).Standard Form: $(x-h)^2 + (y-k)^2 = r^2$
General Form: x^2 + y^2 + Dx + Ey + F = 0 — convert to standard form by completing the square.
MATLAB Commands:
syms x y
% Plot a circle (parametric approach)
theta = linspace(0, 2*pi, 100);
h = 2; k = -1; r = 3;
x_circ = h + r*cos(theta);
y_circ = k + r*sin(theta);
plot(x_circ, y_circ)
axis equal
grid on
title('Circle: (x-2)^2 + (y+1)^2 = 9')
% Convert general form to standard form using completing the square
% x^2 + y^2 - 4x + 6y + 4 = 0
% MATLAB can help you complete the square:
expr_x = x^2 - 4*x;
expr_y = y^2 + 6*y;
% Complete: (x-2)^2 - 4 + (y+3)^2 - 9 + 4 = 0
% So: (x-2)^2 + (y+3)^2 = 9, center (2,-3), radius 3
% Find center and radius from general form using solve
% Alternatively, use fimplicit for implicit equations
fimplicit(x^2 + y^2 - 4*x + 6*y + 4, [-3 7 -8 2])
axis equal
grid on
(x-h)^2 + (y-k)^2 = r^2 → $(x-h)^2 + (y-k)^2 = r^2$ (standard form, center $(h,k)$, radius $r$)
f(x) to denote "the output of f at input x." The domain is the set of all valid inputs; the range is the set of all resulting outputs.Vertical Line Test: A graph represents a function if and only if no vertical line crosses it more than once.
MATLAB Commands:
syms x
% Define a function symbolically
f(x) = x^2 - 3*x + 2;
% Evaluate at a specific input
f(4) % Returns 6
% Evaluate at a symbolic input
f(x + 1) % Returns (x+1)^2 - 3*(x+1) + 2
expand(f(x + 1)) % Expands it
% Find the domain (where the function is defined)
% For rational functions, find where the denominator ≠ 0
g(x) = 1 / (x^2 - 4);
solve(x^2 - 4 == 0, x) % x = ±2 are excluded from domain
% For radical functions, find where radicand ≥ 0
h(x) = sqrt(x - 3);
solve(x - 3 >= 0, x, 'ReturnConditions', true) % Domain: x ≥ 3
% Piecewise functions
pw = piecewise(x < 0, -x, x >= 0, x^2);
fplot(pw, [-3 3])
title('Piecewise function')
MATLAB Commands:
syms x
% Basic function plot
f = x^3 - 3*x;
fplot(f, [-3 3])
grid on
title('f(x) = x^3 - 3x')
% Plot a piecewise function
pw = piecewise(x < -1, x + 1, -1 <= x & x <= 1, x^2, x > 1, 2 - x);
fplot(pw, [-3 3])
title('Piecewise function')
% Find and mark intercepts
x_int = solve(f == 0, x); % x-intercepts
y_int = subs(f, x, 0); % y-intercept
% Multiple functions on one plot
fplot([x^2, x^3, sqrt(x)], [0 4])
legend('x^2', 'x^3', 'sqrt(x)')
grid on
| Operation | Notation | Definition |
|---|---|---|
| Sum | (f + g)(x) |
f(x) + g(x) |
| Difference | (f - g)(x) |
f(x) - g(x) |
| Product | (f * g)(x) |
f(x) * g(x) |
| Quotient | (f / g)(x) |
f(x) / g(x), g(x) ≠ 0 |
| Composition | (f ∘ g)(x) |
f(g(x)) |
MATLAB Commands:
syms x
f(x) = x^2 + 1;
g(x) = 3*x - 2;
% Arithmetic combinations
f(x) + g(x) % Sum
f(x) - g(x) % Difference
f(x) * g(x) % Product
expand(f(x) * g(x)) % Expanded product
f(x) / g(x) % Quotient
% Composition
f(g(x)) % f ∘ g → (3x - 2)^2 + 1
expand(f(g(x))) % Expand it
g(f(x)) % g ∘ f → 3*(x^2 + 1) - 2
simplify(g(f(x)))
% Note: f(g(x)) ≠ g(f(x)) in general!
% compose() also works
compose(f, g, x) % Same as f(g(x))
(f \circ g)(x) = f(g(x)) → $(f \circ g)(x) = f(g(x))$ (composition)
(f + g)(x) = f(x) + g(x) → $(f + g)(x) = f(x) + g(x)$
f⁻¹ reverses f: if f(a) = b, then f⁻¹(b) = a. A function has an inverse if and only if it is one-to-one (passes the horizontal line test). The graphs of f and f⁻¹ are reflections across the line y = x.To find an inverse: Replace f(x) with y, swap x and y, solve for y.
MATLAB Commands:
syms x y
% Find the inverse function
f = 2*x + 5;
inverse_f = solve(y == f, x) % Swap: solve for x in terms of y
% Returns (y - 5)/2, so f^(-1)(y) = (y - 5)/2
% Using finverse()
f_sym = 2*x + 5;
finverse(f_sym) % Returns (x - 5)/2
% Verify: f(f^(-1)(x)) should equal x
f_inv = finverse(f_sym);
simplify(subs(f_sym, x, f_inv)) % Returns x ✓
% Find inverse of a more complex function
g = x^3 - 1;
finverse(g) % Returns (x + 1)^(1/3)
% Plot a function and its inverse together
fplot([2*x + 5, (x-5)/2, x], [-5 10])
legend('f(x) = 2x+5', 'f^{-1}(x) = (x-5)/2', 'y = x')
grid on
title('Function and Inverse')
f^{-1}(x) → $f^{-1}(x)$ (inverse function)
f(f^{-1}(x)) = x → $f(f^{-1}(x)) = x$ (verification)
| Transformation | Effect |
|---|---|
f(x) + c |
Shift up by c |
f(x) - c |
Shift down by c |
f(x + c) |
Shift left by c |
f(x - c) |
Shift right by c |
-f(x) |
Reflect across x-axis |
f(-x) |
Reflect across y-axis |
a*f(x) (a > 1) |
Vertical stretch |
a*f(x) (0 < a < 1) |
Vertical compression |
MATLAB Commands:
syms x
base = x^2;
% Vertical shift
fplot([base, base + 3, base - 2], [-4 4])
legend('x^2', 'x^2 + 3 (up 3)', 'x^2 - 2 (down 2)')
grid on; title('Vertical Shifts')
% Horizontal shift
figure;
fplot([base, (x-2)^2, (x+3)^2], [-6 6])
legend('x^2', '(x-2)^2 (right 2)', '(x+3)^2 (left 3)')
grid on; title('Horizontal Shifts')
% Reflections
figure;
fplot([x^3, -x^3, (-x)^3], [-2 2])
legend('x^3', '-x^3 (reflect x-axis)', '(-x)^3 (reflect y-axis)')
grid on; title('Reflections')
% Stretching and compressing
figure;
fplot([base, 3*base, 0.5*base], [-3 3])
legend('x^2', '3x^2 (stretch)', '0.5x^2 (compress)')
grid on; title('Vertical Stretch/Compress')
f(-x) = f(x) — graph is a mirror image across y-axis.f(-x) = -f(x) — graph is unchanged after 180° rotation.y with -y gives the same equation (not a function).MATLAB Commands:
syms x
% Test if a function is even, odd, or neither
f = x^4 - 3*x^2 + 1;
is_even = isequal(simplify(subs(f, x, -x)), simplify(f));
is_odd = isequal(simplify(subs(f, x, -x)), simplify(-f));
if is_even
disp('Even function (y-axis symmetry)')
elseif is_odd
disp('Odd function (origin symmetry)')
else
disp('Neither even nor odd')
end
% Test x^3
g = x^3;
simplify(subs(g, x, -x)) % Returns -x^3 = -g → odd
Even (y-axis symmetry): f(-x) = f(x) → $f(-x) = f(x)$
Odd (origin symmetry): f(-x) = -f(x) → $f(-x) = -f(x)$
f(x) = c, absolute value f(x) = |x|, square root f(x) = √x, and cubic f(x) = x³.MATLAB Commands:
syms x
% Plot several common functions
figure;
subplot(2,2,1); fplot(5*x^0, [-3 3]); title('Constant: f(x) = 5'); grid on;
subplot(2,2,2); fplot(abs(x), [-3 3]); title('|x|'); grid on;
subplot(2,2,3); fplot(sqrt(x), [0 10]); title('sqrt(x)'); grid on;
subplot(2,2,4); fplot(x^3, [-2 2]); title('x^3'); grid on;
Piecewise: f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}
Renders as: $f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$
f(x) = a(x - h)^2 + k, where (h, k) is the vertex. If a > 0 the parabola opens upward; if a < 0 it opens downward. The axis of symmetry is x = h.MATLAB Commands:
syms x
% Plot a parabola
f = 2*(x - 3)^2 - 5;
fplot(f, [-1 7])
grid on
title('f(x) = 2(x-3)^2 - 5')
% Find the vertex by completing the square
g = x^2 - 6*x + 4;
% Using MATLAB: rewrite g in vertex form
g_expanded = expand(g);
% Complete: (x-3)^2 - 9 + 4 = (x-3)^2 - 5
% Vertex is (3, -5)
% Find vertex numerically: x_vertex = -b/(2a)
coeffs_g = sym2poly(g); % Returns [1 -6 4] (a=1, b=-6, c=4)
a_val = coeffs_g(1);
b_val = coeffs_g(2);
x_vertex = -b_val / (2*a_val); % Returns 3
y_vertex = subs(g, x, x_vertex); % Returns -5
% Find x-intercepts (roots)
solve(g == 0, x) % Returns 3 ± sqrt(5)
f(x) = a(x-h)^2 + k → $f(x) = a(x-h)^2 + k$ (vertex form, vertex at $(h,k)$)
x_{\text{vertex}} = -\frac{b}{2a} → $x_{\text{vertex}} = -\frac{b}{2a}$
(h, k):$\frac{(x-h)^2}{a^2} + \frac{(y-k)^2}{b^2} = 1$
If a > b, the major axis is horizontal with length 2a. If b > a, the major axis is vertical with length 2b. Foci lie along the major axis at distance c from center, where $c^2 = a^2 - b^2$ (if a > b).
MATLAB Commands:
syms x y
% Plot an ellipse using fimplicit
fimplicit((x-1)^2/9 + (y+2)^2/4 - 1, [-5 7 -6 2])
axis equal
grid on
title('Ellipse: (x-1)^2/9 + (y+2)^2/4 = 1')
% Or parametrically
theta = linspace(0, 2*pi, 200);
h = 1; k = -2; a = 3; b = 2;
x_ell = h + a*cos(theta);
y_ell = k + b*sin(theta);
plot(x_ell, y_ell)
axis equal; grid on
% Find the foci
c = sqrt(a^2 - b^2); % c = sqrt(5)
% Foci at (h ± c, k) since a > b (horizontal major axis)
fprintf('Foci: (%.2f, %d) and (%.2f, %d)\n', h-c, k, h+c, k)
\frac{(x-h)^2}{a^2} + \frac{(y-k)^2}{b^2} = 1 → $\frac{(x-h)^2}{a^2} + \frac{(y-k)^2}{b^2} = 1$
c = \sqrt{a^2 - b^2} → $c = \sqrt{a^2 - b^2}$ (foci distance when $a > b$)
Standard Forms (centered at `(h, k)`):
Asymptotes (horizontal case): $y - k = \pm \frac{b}{a}(x - h)$
$c^2 = a^2 + b^2$ gives the distance from center to foci.
MATLAB Commands:
syms x y
% Plot a hyperbola using fimplicit
fimplicit(x^2/4 - y^2/9 - 1, [-6 6 -8 8])
grid on
title('Hyperbola: x^2/4 - y^2/9 = 1')
% Add asymptotes
hold on
fplot([3*x/2, -3*x/2], [-6 6], '--r')
hold off
legend('Hyperbola', 'Asymptote y = 3x/2', 'Asymptote y = -3x/2')
% Find the foci
a = 2; b = 3;
c = sqrt(a^2 + b^2); % c = sqrt(13)
% Foci at (±c, 0) for center-at-origin horizontal hyperbola
Horizontal: \frac{(x-h)^2}{a^2} - \frac{(y-k)^2}{b^2} = 1 → $\frac{(x-h)^2}{a^2} - \frac{(y-k)^2}{b^2} = 1$
Vertical: \frac{(y-k)^2}{a^2} - \frac{(x-h)^2}{b^2} = 1 → $\frac{(y-k)^2}{a^2} - \frac{(x-h)^2}{b^2} = 1$
Asymptotes: y - k = \pm\frac{b}{a}(x - h) → $y - k = \pm\frac{b}{a}(x - h)$
c = \sqrt{a^2 + b^2} → $c = \sqrt{a^2 + b^2}$ (foci distance)
f(x) = p(x)/q(x) where p and q are polynomials. Key features include vertical asymptotes (where q(x) = 0 after cancellation), horizontal asymptotes (end behavior), and holes (common factors that cancel).Horizontal Asymptote Rules (degree of numerator `n`, degree of denominator `m`):
n < m → y = 0n = m → y = (leading coeff of p) / (leading coeff of q)n > m → No horizontal asymptote (may have oblique/slant asymptote)MATLAB Commands:
syms x
f = (2*x^2 - 3*x + 1) / (x^2 - 4);
% Find vertical asymptotes
[num, den] = numden(f);
vertical_asymptotes = solve(den == 0, x) % x = ±2
% Find horizontal asymptote
limit(f, x, inf) % Returns 2 (leading coefficients: 2/1)
% Find x-intercepts (where numerator = 0)
solve(num == 0, x)
% Find y-intercept
subs(f, x, 0)
% Plot with asymptotes
fplot(f, [-10 10], 'MeshDensity', 200)
ylim([-20 20])
hold on
xline(2, '--r'); xline(-2, '--r') % Vertical asymptotes
yline(2, '--g') % Horizontal asymptote
hold off
grid on; title('Rational Function with Asymptotes')
% Find oblique (slant) asymptote when degree(num) = degree(den) + 1
g = (x^2 + 2*x + 1) / (x - 1);
[quotient, remainder] = quorem(x^2 + 2*x + 1, x - 1, x);
% quotient is the slant asymptote
disp(quotient) % Slant asymptote: y = x + 3
f(x) = \frac{p(x)}{q(x)} → $f(x) = \frac{p(x)}{q(x)}$
\lim_{x \to \infty} f(x) = L → $\lim_{x \to \infty} f(x) = L$ (horizontal asymptote)
f(x) = d(x) * q(x) + r(x).Remainder Theorem: The remainder when dividing f(x) by (x - c) equals f(c).
MATLAB Commands:
syms x
% Polynomial long division using quorem (quotient and remainder)
dividend = x^3 - 2*x^2 + 4*x - 3;
divisor = x - 1;
[quotient, remainder] = quorem(dividend, divisor, x);
disp(quotient) % x^2 - x + 3
disp(remainder) % 0
% Verify: dividend = divisor * quotient + remainder
expand(divisor * quotient + remainder) % Should match dividend
% Remainder Theorem: f(c) = remainder when dividing by (x - c)
f = x^3 - 2*x^2 + 4*x - 3;
subs(f, x, 1) % Returns 0, matches remainder
% Synthetic division is done internally by quorem
% But you can also use deconv for numeric coefficient arrays:
p = [1 -2 4 -3]; % coefficients of x^3 - 2x^2 + 4x - 3
d = [1 -1]; % coefficients of x - 1
[q, r] = deconv(p, d);
disp(q) % Quotient coefficients
disp(r) % Remainder coefficients
f(x) = d(x) \cdot q(x) + r(x) → $f(x) = d(x) \cdot q(x) + r(x)$ (Division Algorithm)
f(x) is a value c where f(c) = 0. The multiplicity of a root is the number of times its factor appears. A root of multiplicity k means (x - c)^k divides f(x).Fundamental Theorem of Algebra: A polynomial of degree n has exactly n roots (counting multiplicity), possibly complex.
Factor Theorem: c is a zero of f(x) if and only if (x - c) is a factor of f(x).
MATLAB Commands:
syms x
f = x^4 - 5*x^3 + 9*x^2 - 7*x + 2;
% Find all roots
roots_f = solve(f == 0, x)
% Find roots with multiplicity info
[roots_f, multiplicity] = solve(f == 0, x, 'MaxDegree', 4);
% Check if a value is a root
subs(f, x, 1) % If 0, then x=1 is a root
% Factor to see the roots and multiplicities
factor(f)
% For numeric coefficients, use roots()
p = [1 -5 9 -7 2]; % Coefficients of f
numeric_roots = roots(p);
disp(numeric_roots)
p(x) has integer coefficients, any rational root p/q must have p dividing the constant term and q dividing the leading coefficient.MATLAB Commands:
syms x
f = 2*x^3 - x^2 - 7*x + 6;
% solve() finds all roots directly
solve(f == 0, x)
% To use the Rational Root Theorem approach manually:
% Constant term = 6, leading coeff = 2
% Possible rational roots: ±(factors of 6) / (factors of 2)
% = ±{1, 2, 3, 6, 1/2, 3/2}
% Test candidates
candidates = [1 -1 2 -2 3 -3 6 -6 1/2 -1/2 3/2 -3/2];
for c = candidates
if subs(f, x, c) == 0
fprintf('x = %g is a root\n', c);
end
end
% Factor once you find a root
factor(f)
Rational Root Theorem: possible roots $= \pm\frac{p}{q}$ where $p \mid a_0$ and $q \mid a_n$
End Behavior:
MATLAB Commands:
syms x
f = (x + 2)^2 * (x - 1) * (x - 3);
% Plot with enough range to see all features
fplot(f, [-4 5])
grid on
title('f(x) = (x+2)^2 (x-1)(x-3)')
% Find roots and their multiplicities
factor(f)
% (x+2)^2 → touches at x=-2 (even multiplicity)
% (x-1) → crosses at x=1 (odd multiplicity)
% (x-3) → crosses at x=3 (odd multiplicity)
% Determine the degree and leading coefficient
p_expanded = expand(f);
degree_f = polynomialDegree(p_expanded);
coeffs_f = sym2poly(p_expanded);
leading_coeff = coeffs_f(1);
fprintf('Degree: %d, Leading coeff: %d\n', degree_f, leading_coeff)
% Degree 4, positive leading coeff → both ends up
Rules:
A/(x-a) + B/(x-b) + ...A/(x-a) + B/(x-a)^2 + ...(Ax+B)/(x^2+bx+c) + ...MATLAB Commands:
syms x
% Partial fraction decomposition
f = (3*x + 5) / ((x - 1)*(x + 2));
partfrac(f)
% Returns something like: A/(x-1) + B/(x+2)
% More complex example with repeated roots
g = (x^2 + 2*x + 3) / ((x - 1)^2 * (x + 1));
partfrac(g)
% With irreducible quadratic factor
h = (2*x + 1) / ((x^2 + 1)*(x - 3));
partfrac(h)
% Reverse check: combine back into single fraction
simplify(partfrac(f)) % Should return original f
\frac{A}{x-a} + \frac{B}{x-b} → $\frac{A}{x-a} + \frac{B}{x-b}$ (distinct linear)
\frac{A}{x-a} + \frac{B}{(x-a)^2} → $\frac{A}{x-a} + \frac{B}{(x-a)^2}$ (repeated linear)
\frac{Ax+B}{x^2+bx+c} → $\frac{Ax+B}{x^2+bx+c}$ (irreducible quadratic)
f(x) = b^x where b > 0 and b ≠ 1. The most important base is Euler's number e ≈ 2.71828, giving the natural exponential f(x) = e^x.Key Properties:
b^x is always positiveb^0 = 1 for any valid baseb > 1, the function is increasing (growth)0 < b < 1, the function is decreasing (decay)y = 0MATLAB Commands:
syms x
% Plot exponential functions
fplot([2^x, exp(x), (1/2)^x], [-3 3])
legend('2^x', 'e^x', '(1/2)^x')
grid on
title('Exponential Functions')
% Evaluate
exp(1) % Returns e ≈ 2.7183
2^10 % Returns 1024
% Simplify exponential expressions
simplify(exp(x) * exp(2*x)) % Returns exp(3*x)
simplify(exp(x)^3) % Returns exp(3*x)
f(x) = b^x → $f(x) = b^x$ · e^x → $e^x$ · e \approx 2.71828 → $e \approx 2.71828$
log_b(x) = y means b^y = x. Common logarithm: log10(x). Natural logarithm: ln(x) = log_e(x).Key Properties:
| Property | Rule |
|---|---|
| Product Rule | $\log(ab) = \log a + \log b$ |
| Quotient Rule | $\log(a/b) = \log a - \log b$ |
| Power Rule | $\log(a^n) = n\log a$ |
| Change of Base | $\log_b a = \frac{\ln a}{\ln b}$ |
| $\log_b 1 = 0$ | Any base |
| $\log_b b = 1$ | Log of its own base |
MATLAB Commands:
syms x
% MATLAB's log() is the NATURAL log (ln)
log(exp(1)) % Returns 1
% Common log (base 10)
log10(100) % Returns 2
% Log base 2
log2(64) % Returns 6
% Arbitrary base using change of base formula
% log_base_5(25) = log(25) / log(5)
log(sym(25)) / log(sym(5)) % Returns 2
% Expand logarithmic expressions
expand(log(x^3 * (x+1))) % Returns 3*log(x) + log(x+1)
% Combine (compress) logarithmic expressions
simplify(3*log(x) + log(x + 1)) % May return log(x^3*(x+1))
% Plot log functions
fplot([log(x), log10(x), log2(x)], [0.01 10])
legend('ln(x)', 'log_{10}(x)', 'log_2(x)')
grid on; title('Logarithm Functions')
log(x) is the natural logarithm (ln). Use log10(x) for common log and log2(x) for base-2 log.\log_b x → $\log_b x$ · \ln x → $\ln x$ · \log_{10} x → $\log_{10} x$
\log_b(mn) = \log_b m + \log_b n → $\log_b(mn) = \log_b m + \log_b n$
\log_b\left(\frac{m}{n}\right) = \log_b m - \log_b n → $\log_b\left(\frac{m}{n}\right) = \log_b m - \log_b n$
\log_b(m^n) = n\log_b m → $\log_b(m^n) = n\log_b m$
\log_b a = \frac{\ln a}{\ln b} → $\log_b a = \frac{\ln a}{\ln b}$ (change of base)
MATLAB Commands:
syms x
% Same base on both sides: 2^(3x) = 2^7
solve(2^(3*x) == 2^7, x) % Returns 7/3
% Different bases: take log of both sides
solve(3^x == 10, x) % Returns log(10)/log(3)
double(solve(3^x == 10, x)) % Numeric: ≈ 2.0959
% Exponential equation requiring algebraic manipulation
solve(exp(2*x) - 5*exp(x) + 6 == 0, x) % Reducible to quadratic in e^x
% Compound interest: A = P*(1 + r/n)^(n*t)
% How long to double $1000 at 5% compounded monthly?
syms t
solve(2000 == 1000*(1 + 0.05/12)^(12*t), t)
MATLAB Commands:
syms x
% Basic log equation: log(x) = 3 means e^3 = x
solve(log(x) == 3, x) % Returns exp(3)
% Log equation requiring combination
solve(log(x) + log(x - 3) == log(10), x)
% Check for extraneous solutions (domain: arguments must be > 0)
solutions = solve(log(x) + log(x - 3) == log(10), x);
for k = 1:length(solutions)
val = double(solutions(k));
if val > 0 && (val - 3) > 0
fprintf('x = %.4f is VALID\n', val);
else
fprintf('x = %.4f is EXTRANEOUS\n', val);
end
end
log10 of intensity ratios.MATLAB Commands:
syms t P r k
% Compound interest: time to reach a target
% $5000 at 6% compounded quarterly, when does it reach $8000?
solve(8000 == 5000*(1 + 0.06/4)^(4*t), t)
% Continuous compounding
solve(8000 == 5000*exp(0.06*t), t)
% Exponential decay: half-life
% If half-life is 5 years, find the decay constant k
k_val = -log(2) / 5; % Negative for decay
fprintf('Decay constant k = %.4f\n', k_val)
% How much remains after 12 years starting with 100 grams?
Q0 = 100;
Q_12 = Q0 * exp(k_val * 12);
fprintf('After 12 years: %.2f grams\n', Q_12)
% Population growth: 1000 bacteria, doubles every 3 hours
% Q(t) = 1000 * 2^(t/3)
syms t_pop
pop = 1000 * 2^(t_pop/3);
fplot(pop, [0 24])
xlabel('Hours'); ylabel('Population')
title('Bacterial Growth')
grid on
A = P\left(1 + \frac{r}{n}\right)^{nt} → $A = P\left(1 + \frac{r}{n}\right)^{nt}$ (compound interest)
A = Pe^{rt} → $A = Pe^{rt}$ (continuous compounding)
N(t) = N_0 e^{kt} → $N(t) = N_0 e^{kt}$ (growth/decay)
t_{1/2} = \frac{\ln 2}{|k|} → $t_{1/2} = \frac{\ln 2}{|k|}$ (half-life)
MATLAB Commands:
syms x y
% Solve a 2-variable system
[sol_x, sol_y] = solve([2*x + 3*y == 7, x - y == 1], [x, y]);
fprintf('x = %s, y = %s\n', char(sol_x), char(sol_y))
% Visualize: plot both lines
fplot([(7 - 2*x)/3, x - 1], [-2 5])
legend('2x + 3y = 7', 'x - y = 1')
grid on; title('System of 2 Equations')
% Inconsistent system (parallel lines, no solution)
sol = solve([2*x + y == 3, 2*x + y == 5], [x, y]);
% Returns empty — no solution
% Dependent system (same line, infinite solutions)
sol = solve([2*x + y == 3, 4*x + 2*y == 6], [x, y]);
% Returns parametric solution
System: \begin{cases} 2x + 3y = 7 \\ x - y = 1 \end{cases} → $\begin{cases} 2x + 3y = 7 \\ x - y = 1 \end{cases}$
MATLAB Commands:
syms x y z
% Solve a 3-variable system
eqs = [x + y + z == 6, 2*x - y + z == 3, x + 2*y - z == 2];
[sol_x, sol_y, sol_z] = solve(eqs, [x, y, z]);
fprintf('x = %s, y = %s, z = %s\n', char(sol_x), char(sol_y), char(sol_z))
% Using matrix form Ax = b
A = [1 1 1; 2 -1 1; 1 2 -1];
b = [6; 3; 2];
solution = A \ b; % Backslash operator solves Ax = b
disp(solution)
% linsolve does the same thing
solution = linsolve(A, b);
disp(solution)
[A | b] combines the coefficient matrix and constant vector. Row operations (swap rows, multiply a row by a scalar, add a multiple of one row to another) are used to reduce the matrix to row-echelon form (REF) or reduced row-echelon form (RREF).Row Operations:
MATLAB Commands:
% Create the augmented matrix
A_aug = [1 1 1 6; 2 -1 1 3; 1 2 -1 2];
% Reduce to RREF (Reduced Row Echelon Form) in one step
rref(A_aug)
% Returns [1 0 0 x; 0 1 0 y; 0 0 1 z]
% Step-by-step row operations (manual practice)
% R2 = R2 - 2*R1
A_aug(2,:) = A_aug(2,:) - 2*A_aug(1,:);
disp(A_aug)
% R3 = R3 - R1
A_aug(3,:) = A_aug(3,:) - A_aug(1,:);
disp(A_aug)
% Continue until in RREF...
% For symbolic augmented matrices
syms a b c
A_sym = sym([1 2 a; 3 4 b; 5 6 c]);
rref(A_sym)
[0 0 0 ... | nonzero] — no solution.[0 0 0 ... | 0] — infinitely many solutions (free variables).MATLAB Commands:
% Inconsistent system example
A_inc = [1 1 1; 2 2 2; 1 0 1];
b_inc = [3; 7; 4]; % Note: 2*(row1) would give [2 2 2 | 6] but we have 7
rref([A_inc b_inc]) % Will show a row [0 0 0 | nonzero]
% Dependent system example
A_dep = [1 2 3; 2 4 6; 1 1 1];
b_dep = [6; 12; 3]; % Row 2 = 2 * Row 1
rref([A_dep b_dep]) % Will show a row of all zeros
% Check rank to determine solution type
rank(A_inc) % Compare to rank of augmented matrix
rank([A_inc b_inc]) % If different → inconsistent
Augmented matrix: \left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \\ 0 & 1 & 3 & 5 \\ 0 & 0 & 1 & 2 \end{array}\right]
→ $\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \\ 0 & 1 & 3 & 5 \\ 0 & 0 & 1 & 2 \end{array}\right]$
Matrix: \begin{bmatrix} a & b \\ c & d \end{bmatrix} → $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$
MATLAB Commands:
syms x y
% Circle and line
eqs = [x^2 + y^2 == 25, y == x + 1];
[sol_x, sol_y] = solve(eqs, [x, y]);
disp([sol_x, sol_y])
% Parabola and line
eqs = [y == x^2, y == 2*x + 3];
[sol_x, sol_y] = solve(eqs, [x, y]);
disp([sol_x, sol_y])
% Visualize the intersection
fimplicit(x^2 + y^2 - 25, [-6 6 -6 6])
hold on
fplot(x + 1, [-6 6])
plot(double(sol_x), double(sol_y), 'ro', 'MarkerSize', 10)
hold off
axis equal; grid on
title('Circle and Line Intersection')
legend('x^2 + y^2 = 25', 'y = x + 1', 'Solutions')
% Two conics
eqs = [x^2 + y^2 == 10, x^2 - y^2 == 4];
[sol_x, sol_y] = solve(eqs, [x, y]);
disp([sol_x, sol_y]) % Can have up to 4 solutions
| Task | Command | Example |
|---|---|---|
| Declare symbolic variables | syms x y z |
syms x |
| Simplify | simplify(expr) |
simplify(x^2/x) → x |
| Expand | expand(expr) |
expand((x+1)^2) → x^2+2*x+1 |
| Factor | factor(expr) |
factor(x^2-1) → (x-1)*(x+1) |
| Collect terms | collect(expr, var) |
collect(x*y + x, x) → x*(y+1) |
| Solve equation | solve(eqn, var) |
solve(x^2==4, x) → [-2; 2] |
| Solve inequality | solve(ineq, var, 'ReturnConditions', true) |
|
| Substitute a value | subs(expr, var, val) |
subs(x^2, x, 3) → 9 |
| Partial fractions | partfrac(expr) |
|
| Polynomial division | [q, r] = quorem(p, d, x) |
|
| Polynomial degree | polynomialDegree(p) |
|
| Find inverse function | finverse(f) |
finverse(2*x+1) → (x-1)/2 |
| Composition | compose(f, g) |
|
| Plot (symbolic) | fplot(f, [a b]) |
fplot(x^2, [-5 5]) |
| Plot implicit eq | fimplicit(eqn, [range]) |
|
| Piecewise function | piecewise(cond1, val1, ...) |
|
| Pretty print | pretty(expr) |
|
| RREF | rref(matrix) |
|
| Solve linear system (matrix) | x = A \ b |
|
| Limits | limit(f, x, val) |
limit(1/x, x, inf) → 0 |
| Natural log | log(x) |
Note: this is ln(x) |
| Common log | log10(x) |
|
| Log base 2 | log2(x) |
syms — declare your variables before using them symbolically.simplify() liberally — it's your best friend for cleaning up messy expressions.expand() then collect() — great one-two punch for reorganizing polynomials.pretty() — makes output more readable in the Command Window..m script files, not just the Command Window.% for comments — annotate your scripts so you remember what each line does.doc commandname — opens the full help page for any command.; at the end of a line to keep the Command Window clean.clear; clc; at the top of scripts — clears variables and the Command Window for a fresh start.double() converts symbolic results to decimal numbers when you need numeric values.