Sub topic 3
The fraction bar groups the top and the bottom
This chapter assumes you can evaluate expressions with parentheses, exponents, and negative integers, and that you can add and multiply fractions.
The fraction bar is a grouping symbol
A fraction bar works like parentheses. The whole numerator is one group, and the whole denominator is another. So (3 + 5) / (2 + 2) equals 2, but 3 + 5 / 2 + 2 equals 7.5, because the bar would only divide the 5.
Raising a fraction to a power
An exponent applies to the whole fraction when the fraction is in parentheses. (2/3)^2 equals 4/9, because both the top and the bottom are squared.
Zero and negative exponents
Any nonzero base raised to the power 0 equals 1. A negative exponent gives the reciprocal: 2^-2 equals 1/4.
from fractions import Fraction
print(Fraction(2, 3) ** 0) # 1
print(Fraction(2, 3) ** -2) # 9/4
print(2 ** -2) # 0.25Stacked exponents
Exponents stack from the top down. 2^3^2 means 2^(3^2), which is 2^9 = 512, not (2^3)^2 = 64.
Ambiguous notation
Expressions such as 8 ÷ 2(2 + 2) have no agreed answer. Python reads them left to right and returns 16.0, but some calculators return 1. Write the grouping explicitly, for example 8 / (2 * (2 + 2)), to avoid the problem.
Common mistakes and why PEMDAS can mislead
PEMDAS is a memory aid, not a complete rule. Learners often apply addition before multiplication, or treat -3^2 as (-3)^2. The minus sign is applied after the exponent, so -3^2 equals -9.
Checking your work with Python
Compare a hand calculation with a program. The example below checks the result 5/6.
from fractions import Fraction
hand_answer = Fraction(5, 6)
expression = Fraction(1, 2) + Fraction(3, 4) * Fraction(2, 3) ** 2
print(expression) # 5/6
print(expression == hand_answer) # TrueExercise
What is (2/3)^-2 + 0^0? Give the value as a fraction.
Show answer
(2/3)^-2 is (3/2)^2 = 9/4, and 0^0 is 1 by convention, so the sum is 9/4 + 1 = 13/4.