<lambdifygenerated-2>:2: RuntimeWarning: divide by zero encountered in power
return (x - 2)**(-1.0)

After this lesson you should be able to:
A rational function such as f(x) = 1/(x - 2) looks harmless, but x = 2 is not allowed because the denominator would be zero. A radical function such as g(x) = sqrt(x - 3) also carries a warning: in real-valued algebra, x must be at least 3.
Restrictions tell us which answers are allowed, where graphs break, and when a simplified formula is missing information from the original problem.
Whenever a formula contains a variable in a denominator or an even root, ask: which inputs are allowed?
A rational expression is a quotient of polynomials:
(x + 1)/(x - 4)
(x^2 - 9)/(x^2 - x - 6)
A rational function is a function defined by a rational expression. The denominator cannot be zero, so the first step is usually to solve:
denominator = 0
and exclude those values from the domain.
Consider:
(x^2 - 4)/(x - 2)
Factor the numerator:
((x - 2)(x + 2))/(x - 2)
For allowed values, the common factor cancels and the visible formula becomes:
x + 2
But the original denominator still forbids x = 2.
The simplified formula x + 2 is defined at x = 2, but the original expression is not. Always state restrictions from the original expression.
Simplify:
(x^2 - 9)/(x^2 - x - 6)
Factor:
x^2 - 9 = (x - 3)(x + 3)
x^2 - x - 6 = (x - 3)(x + 2)
List denominator zeros before canceling:
x = 3 or x = -2
Cancel the common factor:
((x - 3)(x + 3))/((x - 3)(x + 2)) = (x + 3)/(x + 2)
Final answer:
(x + 3)/(x + 2), with x != 3 and x != -2
The canceled factor produces a hole at x = 3. The remaining denominator factor produces a vertical asymptote at x = -2.
Rational expressions follow fraction rules.
(x^2 - 1)/(x + 3) * (x + 3)/(x - 1)
= ((x - 1)(x + 1))/(x + 3) * (x + 3)/(x - 1)
= x + 1
Restrictions from the original denominators: x != -3 and x != 1.
Dividing by a rational expression means multiplying by its reciprocal:
(x + 2)/(x - 5) ÷ (x + 2)/(x + 1)
= (x + 2)/(x - 5) * (x + 1)/(x + 2)
= (x + 1)/(x - 5)
Also exclude values that make the divisor zero.
Use a common denominator:
1/(x - 1) + 2/(x + 1)
= (x + 1)/((x - 1)(x + 1)) + 2(x - 1)/((x - 1)(x + 1))
= (3x - 1)/((x - 1)(x + 1))
Restrictions: x != 1 and x != -1.
A safe routine is:
Solve:
1/(x - 1) + 2/(x + 1) = 1
Forbidden values: x != 1 and x != -1.
Multiply by (x - 1)(x + 1):
x + 1 + 2(x - 1) = (x - 1)(x + 1)
3x - 1 = x^2 - 1
3x = x^2
x(x - 3) = 0
Candidates are x = 0 and x = 3. Both work in the original equation, so the solution set is {0, 3}.
For horizontal asymptotes, compare degrees:
| Degrees | Horizontal behavior |
|---|---|
| numerator degree smaller | y = 0 |
| equal degrees | ratio of leading coefficients |
| numerator degree larger by one | slant asymptote preview |
<lambdifygenerated-2>:2: RuntimeWarning: divide by zero encountered in power
return (x - 2)**(-1.0)

A radical expression contains a root, and the expression inside the root is the radicand.
sqrt(x - 5)
root_3(x + 2)
In real-valued algebra:
Examples:
sqrt(x - 5) requires x >= 5
root_3(x - 5) allows all real x
Radicals can also be written with rational exponents:
sqrt(x) = x^(1/2)
root_3(x^2) = x^(2/3)
In real-valued algebra, sqrt(x^2) = |x|, not always x.
Squaring both sides can introduce extraneous solutions, so always check.
Solve:
sqrt(x + 5) = x - 1
Since a square root is nonnegative, x - 1 >= 0, so x >= 1. Square both sides:
x + 5 = (x - 1)^2
x + 5 = x^2 - 2x + 1
0 = x^2 - 3x - 4
0 = (x - 4)(x + 1)
Candidates: x = 4 and x = -1.
Check:
x = 4: sqrt(9) = 3 and 4 - 1 = 3, works.x = -1: sqrt(4) = 2 but -1 - 1 = -2, fails.Final answer: x = 4.
Browser-friendly symbolic tools can help you experiment:
Try these exercises online:
(x^2 - 9)/(x^2 - x - 6), then manually state restrictions.(x + 5)/(x^2 - 4).(x^2 - 16)/(x^2 - 2x - 8) and state restrictions.(x^2 - 1)/(x + 2) by (x + 2)/(x - 1) and state restrictions.2/(x - 3) = 5/(x + 1).(x + 1)/(x - 4).(x^2 - 25)/(x - 5).sqrt(2x - 6).root_3(x^5) using rational exponents.sqrt(x + 6) = x and check for extraneous solutions.A. Write a radical model for side length and state a domain.x = -2 and x = 2.(x + 4)/(x + 2), with x != 4 and x != -2.x + 1, with x != -2 and x != 1.2(x + 1)=5(x - 3), so x = 17/3.x = 4.x + 5, but x = 5 is missing, so the hole is (5, 10).2x - 6 >= 0, so x >= 3.x^(5/3).x^2 - x - 6 = 0; candidates 3 and -2; only 3 works.s(A) = sqrt(A), with A >= 0.Rational and radical problems are solved safely only when restrictions stay visible. Guess the restrictions before simplifying or solving.
Guess first. What value is forbidden in (x + 5)/(x - 4)?
Guided exercise.
Set the denominator equal to zero:
x - 4 = 0
x = 4
So the domain is all real numbers except 4.
Checkpoint. Find the forbidden values for (x^2 + 1)/(x^2 - 9).
Guess first. In (x^2 - 1)/(x - 1), does canceling remove every memory of x = 1?
Guided exercise.
(x^2 - 1)/(x - 1)
= ((x - 1)(x + 1))/(x - 1)
= x + 1, but x != 1
The visible graph follows the line y = x + 1, but the original function has a hole at x = 1.
Checkpoint. Simplify (x^2 - 4)/(x + 2) and state the excluded value.
Guess first. For 1/(x - 2) = 3, should the solution be greater than 2 or less than 2?
Guided exercise.
1/(x - 2) = 3
x != 2 restriction
1 = 3(x - 2) multiply by x - 2
1 = 3x - 6
7 = 3x
x = 7/3
Check: 7/3 is not forbidden, and 1/(7/3 - 2) = 1/(1/3) = 3.
Checkpoint. Solve 2/(x + 1) = 5. State the restriction and check the candidate.
Guess first. For sqrt(x + 5) = x - 1, must x - 1 be nonnegative?
Guided exercise.
sqrt(x + 5) = x - 1
x - 1 >= 0, so x >= 1 because square roots are nonnegative
x + 5 = (x - 1)^2 square both sides
x + 5 = x^2 - 2x + 1
0 = x^2 - 3x - 4
0 = (x - 4)(x + 1)
x = 4 or x = -1
Only x = 4 satisfies the restriction and the original equation.
Checkpoint. Solve sqrt(x + 1) = x - 1. Check every candidate in the original radical equation.
Use this checkpoint to practice domains, holes, asymptotes, and radical checks.
Use the parser/solver workflow to check candidate solutions. For rational and radical equations, still inspect restrictions and original-equation checks.
Answer: x = 7/3
Method: SymPy solveset
Steps:
1. Original equation:
Eq(1/(x - 1*2), 3)
2. Solve symbolically:
x ∈ {7/3}
SymPy found the solution set directly.
Check:
x = 7/3: valid
Use SymPy to check algebraic forms, while you remain responsible for restrictions.
((x + 3)/(x + 2), (x + 3)/(x + 2))
((x - 3)*(x + 2), [-2, 3])
[(0, True), (3, True)]