diff --git a/content/math/algebraic-fractions-formulas/_index.md b/content/math/algebraic-fractions-formulas/_index.md new file mode 100644 index 0000000..5ccaa0d --- /dev/null +++ b/content/math/algebraic-fractions-formulas/_index.md @@ -0,0 +1,437 @@ ++++ +title = "Algebraic fractions & formulas" +description = "Simplify and combine algebraic fractions; rearrange formulas in science contexts." +template = "chapter.html" +weight = 2 +[extra] +subject = "math" +chapter_id = "algebraic-fractions-formulas" +strand = "Number & Algebra" ++++ + +
+

+ An algebraic fraction is a fraction whose numerator and denominator are + polynomials (or monomials). The same ideas you use for numbers — simplify, find a common + denominator, and combine — apply here, with extra care: you may only cancel + common factors, and you must note values of the variable that would make a + denominator zero. +

+ +

Assumed knowledge recap

+

+ This chapter builds on expanding and factorising polynomials. If you have not studied those + topics yet, use the callout below as a minimal toolkit. +

+ +
+

Before you start

+ +
+ +

Simplifying algebraic fractions

+

+ To simplify, factorise the numerator and denominator completely, then divide out any common + factors. +

+ +
+

Rule

+

+ \[ \frac{ac}{bc} = \frac{a}{b} \quad (b \neq 0,\; c \neq 0) \] +

+

Here \(c\) is a common factor of the top and bottom, not a term added to each.

+
+ +

Example. Simplify \(\dfrac{x^2 - 1}{x^2 + x}\).

+

+ Factorise: \(x^2 - 1 = (x-1)(x+1)\) and \(x^2 + x = x(x+1)\). Cancel the common factor + \((x+1)\): + \[ \frac{(x-1)(x+1)}{x(x+1)} = \frac{x-1}{x}, \quad x \neq 0,\; x \neq -1. \] + The restrictions matter: at \(x = -1\) the original denominator is zero. +

+ +

Example. Simplify \(\dfrac{2x^2 - 8}{x^2 - 4}\).

+

+ \[ \frac{2(x^2-4)}{x^2-4} = \frac{2(x-2)(x+2)}{(x-2)(x+2)} = 2, \quad x \neq 2,\; x \neq -2. \] +

+ +

Adding and subtracting

+

+ Use a common denominator (the LCM of the denominators), as with numeric + fractions. +

+ +

Example. \(\dfrac{2}{x} + \dfrac{3}{x+1}\).

+

+ LCD is \(x(x+1)\): + \[ \frac{2}{x} + \frac{3}{x+1} = \frac{2(x+1) + 3x}{x(x+1)} = \frac{5x+2}{x(x+1)}, \quad x \neq 0,\; x \neq -1. \] +

+ +

Example. \(\dfrac{1}{x-2} - \dfrac{3}{x^2 - 4}\).

+

+ Note \(x^2 - 4 = (x-2)(x+2)\). With LCD \((x-2)(x+2)\): + \[ \frac{x+2}{(x-2)(x+2)} - \frac{3}{(x-2)(x+2)} = \frac{x-1}{(x-2)(x+2)}, \quad x \neq 2,\; x \neq -2. \] +

+ +

Multiplying and dividing

+

+ Multiply numerators and denominators; factorise before cancelling. To divide, multiply by the + reciprocal of the divisor. +

+ +
+

Divide

+

+ \[ \frac{A}{B} \div \frac{C}{D} = \frac{A}{B} \times \frac{D}{C} \] +

+
+ +

Example. \(\dfrac{x^2 - 9}{2x} \times \dfrac{4}{x+3}\).

+

+ \[ \frac{(x-3)(x+3)}{2x} \times \frac{4}{x+3} = \frac{4(x-3)}{2x} = \frac{2(x-3)}{x}, \quad x \neq 0,\; x \neq -3. \] +

+ +

Example. \(\dfrac{x^2 - 1}{x+1} \div \dfrac{x-1}{2}\).

+

+ \[ \frac{(x-1)(x+1)}{x+1} \times \frac{2}{x-1} = 2, \quad x \neq -1,\; x \neq 1. \] +

+ +

Harder examples

+

+ These use the same rules; the algebra is longer. Work factorisation and the LCD carefully. +

+ +

Example. \(\dfrac{1}{x} + \dfrac{1}{x+1}\) (already seen) gives + \(\dfrac{5x+2}{x(x+1)}\).

+ +

Example. Simplify \(\dfrac{x}{x^2 - 5x + 6}\).

+

+ Factorise \(x^2 - 5x + 6 = (x-2)(x-3)\): + \[ \frac{x}{(x-2)(x-3)}, \quad x \neq 2,\; x \neq 3. \] +

+ +

Changing the subject of a formula

+

+ A formula links several quantities. Changing the subject means + rewriting the formula so that one chosen letter stands alone on one side — like solving an + equation for that letter. +

+

+ Undo operations in reverse order to how they build the right-hand side: if the + target variable is multiplied, divide; if it is inside a bracket, expand or divide through; + if it appears in a denominator, multiply both sides by that denominator. +

+ +

Example. Make \(t\) the subject of \(v = \dfrac{d}{t}\) (\(t \neq 0\)).

+

+ Multiply both sides by \(t\): \(vt = d\). Divide by \(v\) (assuming \(v \neq 0\)): + \[ t = \frac{d}{v}. \] +

+ +

Example. Make \(A\) the subject of \(P = \dfrac{F}{A}\) (\(A \neq 0\)).

+

+ Multiply by \(A\): \(PA = F\), so \(A = \dfrac{F}{P}\) (\(P \neq 0\)). +

+ +

Example. Make \(R\) the subject of \(V = IR\).

+

+ Divide by \(I\) (assuming \(I \neq 0\)): \(R = \dfrac{V}{I}\). +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FormulaMeaning (typical units)
\(v = d/t\)speed = distance ÷ time
\(P = F/A\)pressure = force ÷ area
\(V = IR\)voltage = current × resistance
\(\rho = m/V\)density = mass ÷ volume
+
+
+ +
+

History

+

+ For centuries, algebra was written in words. In the 16th and 17th centuries, mathematicians such + as François Viète began to use letters systematically for both unknowns and + known parameters. That made formulas — general relationships such as + \(v = d/t\) — easy to rearrange without repeating long verbal rules. +

+

+ Rational expressions (fractions built from polynomials) appear whenever you divide one polynomial + by another. Scientists from Galileo onward used ratios and proportionalities in + motion; later, Newton’s laws and electrical laws (e.g. \(V = IR\)) relied on + changing the subject of a formula to solve for the quantity you can measure. +

+

+ Today, algebraic fractions show up in simplifying models, in calculus limits, and whenever a + relationship is written as one quantity divided by another. +

+ +

Derivation

+ +

Why can we cancel a common factor?

+

+ If \(c \neq 0\), then \(\dfrac{ac}{bc} = \dfrac{a}{b}\) because multiplying numerator and + denominator by the same non-zero number does not change the value of a numeric fraction; the + same idea holds when \(c\) is a polynomial factor shared by top and bottom. +

+

+ You cannot cancel in \(\dfrac{a+c}{b+c}\) in general — that would mean, for example, + \(\dfrac{1+2}{3+2} = \dfrac{1}{3}\), which is false. Only factors, not + terms, may be cancelled. +

+ +

Why reverse the order of operations?

+

+ A formula like \(v = d/t\) builds \(v\) by first dividing \(d\) by \(t\). To recover \(t\), + undo division by multiplying: \(vt = d\), then undo multiplication by \(v\) (when \(v \neq 0\)) + to get \(t = d/v\). Each step reverses one operation that was applied to the subject you want. +

+ +

Checkpoints

+

+ Pause and reason before continuing. Discuss with a partner or write your work in a notebook. +

+ +
+

Checkpoint

+

+ Simplify \(\dfrac{x^2 - 4}{x + 2}\). What value of \(x\) must be excluded? +

+
+ +
+

Checkpoint

+

+ Can you cancel the \(x\) in \(\dfrac{x + 1}{x}\)? Explain briefly. +

+
+ +
+

Checkpoint

+

+ Write \(\dfrac{3}{x} - \dfrac{1}{2x}\) as a single fraction in simplest form. +

+
+ +
+

Checkpoint

+

+ Make \(d\) the subject of \(v = \dfrac{d}{t}\). State any conditions on \(t\) and \(v\). +

+
+ +
+

Checkpoint

+

+ A wire obeys \(V = IR\). If voltage and resistance are known, which formula gives current? +

+
+ +
+

Checkpoint

+

+ Simplify \(\dfrac{1}{x} + \dfrac{1}{x+1}\). What is the common denominator? +

+
+ +

Applications

+ +

Uniform motion

+

+ For constant speed, distance \(d\), speed \(v\), and time \(t\) are related by \(v = d/t\). If a + train travels \(240\) km in \(3\) h, then \(v = 240/3 = 80\) km/h. If you know \(v\) and \(t\) + but need distance, rearrange to \(d = vt\). +

+ +
+ +

Density

+

+ Density \(\rho\) (rho) is mass per unit volume: \(\rho = m/V\). A block of mass \(2.7\) kg with + volume \(0.001\) m³ has \(\rho = 2.7/0.001 = 2700\) kg/m³. To find mass from \(\rho\) and \(V\), + use \(m = \rho V\). +

+ +

Pressure and electric circuits

+

+ Pressure \(P = F/A\) links force \(F\) and area \(A\). Hydraulic and weather models often solve + for \(F = PA\). In a resistor, \(V = IR\) gives voltage from current and resistance; rearrange + to \(I = V/R\) when you know voltage and resistance. +

+ +
+ +

Question bank

+

+ Work each question, then open the solution to check your reasoning. Difficulty increases + through the sets. +

+ +

Easy

+ +
+ Simplify \(\dfrac{6x}{3x}\). +
+

Answer: \(2\), with \(x \neq 0\).

+

Steps: Cancel the common factor \(3x\).

+
+
+ +
+ Simplify \(\dfrac{x^2}{x}\) for \(x \neq 0\). +
+

Answer: \(x\).

+

Explanation: Cancel one factor \(x\) from numerator and denominator.

+
+
+ +
+ Make \(d\) the subject of \(v = d/t\). +
+

Answer: \(d = vt\) (\(t \neq 0\) when rearranging from the original).

+

Steps: Multiply both sides by \(t\).

+
+
+ +
+ Make \(R\) the subject of \(V = IR\). +
+

Answer: \(R = V/I\) (\(I \neq 0\)).

+

Steps: Divide both sides by \(I\).

+
+
+ +

Intermediate

+ +
+ Simplify \(\dfrac{x^2 - 9}{x + 3}\). +
+

Answer: \(x - 3\), with \(x \neq -3\).

+

Steps: \(x^2 - 9 = (x-3)(x+3)\); cancel \((x+3)\).

+
+
+ +
+ \(\dfrac{2}{x} + \dfrac{1}{x} = \) ______ +
+

Answer: \(\dfrac{3}{x}\), \(x \neq 0\).

+

Explanation: Same denominator already.

+
+
+ +
+ Simplify \(\dfrac{x^2 - 1}{x^2 + x}\). +
+

Answer: \(\dfrac{x-1}{x}\), \(x \neq 0,\; x \neq -1\).

+

Steps: Factorise; cancel \((x+1)\).

+
+
+ +
+ Make \(m\) the subject of \(\rho = m/V\). +
+

Answer: \(m = \rho V\) (\(V \neq 0\) in the original).

+

Steps: Multiply both sides by \(V\).

+
+
+ +

Difficult

+ +
+ \(\dfrac{1}{x} + \dfrac{2}{x+1} = \) ______ +
+

Answer: \(\dfrac{3x+1}{x(x+1)}\), \(x \neq 0,\; x \neq -1\).

+

Steps: LCD \(x(x+1)\); numerator \( (x+1) + 2x = 3x+1\).

+
+
+ +
+ \(\dfrac{x}{2} \times \dfrac{4}{x^2} = \) ______ +
+

Answer: \(\dfrac{2}{x}\), \(x \neq 0\).

+

Steps: Multiply; cancel a factor \(x\).

+
+
+ +
+ Simplify \(\dfrac{1}{x-2} - \dfrac{3}{x^2 - 4}\). +
+

Answer: \(\dfrac{x-1}{(x-2)(x+2)}\), \(x \neq 2,\; x \neq -2\).

+

Steps: Write \(x^2-4 = (x-2)(x+2)\); common denominator \((x-2)(x+2)\).

+
+
+ +

Hardcore

+ +
+ \(\dfrac{x^2 - 1}{x+1} \div \dfrac{x-1}{2} = \) ______ +
+

Answer: \(2\), with \(x \neq -1,\; x \neq 1\).

+

Steps: Factorise \(x^2-1\); multiply by reciprocal; cancel \((x-1)\) and \((x+1)\).

+
+
+ +
+ Make \(t\) the subject of \(v = \dfrac{d}{t}\) and then find \(t\) when \(d = 150\) km and \(v = 75\) km/h. +
+

Answer: \(t = d/v = 2\) h.

+

Steps: \(vt = d \Rightarrow t = d/v\); substitute values.

+
+
+ +
+ Simplify fully: \(\dfrac{2x^2 - 8}{x^2 - 4}\). +
+

Answer: \(2\), \(x \neq 2,\; x \neq -2\).

+

Steps: Factorise numerator \(2(x^2-4)\) and denominator \((x-2)(x+2)\); cancel \((x-2)(x+2)\).

+
+
+ +
+ A formula is \(P = \dfrac{F}{A}\). The force is \(120\) N and the area is \(0.05\) m². Find \(P\), then make \(F\) the subject and verify your force value. +
+

Answer: \(P = 120/0.05 = 2400\) Pa; \(F = PA = 2400 \times 0.05 = 120\) N.

+

Explanation: Rearranging checks that the formula is consistent.

+
+
+ +

References

+ +
diff --git a/content/math/algebraic-fractions-formulas/chapter.scss b/content/math/algebraic-fractions-formulas/chapter.scss new file mode 100644 index 0000000..494fcd4 --- /dev/null +++ b/content/math/algebraic-fractions-formulas/chapter.scss @@ -0,0 +1,49 @@ +.formula-rearrange-demo__select { + width: 100%; + max-width: 100%; + padding: 0.5rem 0.65rem; + border: 1px solid var(--line); + border-radius: 8px; + font-family: var(--body); + font-size: 0.9rem; + color: var(--ink); + background: var(--card-bg); +} + +.fraction-simplify-demo__steps, +.formula-rearrange-demo__steps { + margin: 0; + padding: 0; + list-style: none; + display: flex; + flex-direction: column; + gap: 14px; +} + +.fraction-simplify-demo__steps > li, +.formula-rearrange-demo__steps > li { + display: flex; + flex-direction: column; + gap: 6px; + padding: 12px; + border: 1px solid var(--line); + border-radius: 10px; + background: rgba(154, 107, 46, 0.04); +} + +.fraction-simplify-demo__step-label { + font-family: var(--mono); + font-size: 0.65rem; + font-weight: 700; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--muted); +} + +.scenario-demo__formula--inline { + font-size: 0.95rem; +} + +.fraction-simplify-demo__restriction .katex { + font-size: 0.95rem; +} diff --git a/content/math/algebraic-fractions-formulas/core.html b/content/math/algebraic-fractions-formulas/core.html new file mode 100644 index 0000000..9cfa3a4 --- /dev/null +++ b/content/math/algebraic-fractions-formulas/core.html @@ -0,0 +1,171 @@ +
+

+ An algebraic fraction is a fraction whose numerator and denominator are + polynomials (or monomials). The same ideas you use for numbers — simplify, find a common + denominator, and combine — apply here, with extra care: you may only cancel + common factors, and you must note values of the variable that would make a + denominator zero. +

+ +

Assumed knowledge recap

+

+ This chapter builds on expanding and factorising polynomials. If you have not studied those + topics yet, use the callout below as a minimal toolkit. +

+ +
+

Before you start

+ +
+ +

Simplifying algebraic fractions

+

+ To simplify, factorise the numerator and denominator completely, then divide out any common + factors. +

+ +
+

Rule

+

+ \[ \frac{ac}{bc} = \frac{a}{b} \quad (b \neq 0,\; c \neq 0) \] +

+

Here \(c\) is a common factor of the top and bottom, not a term added to each.

+
+ +

Example. Simplify \(\dfrac{x^2 - 1}{x^2 + x}\).

+

+ Factorise: \(x^2 - 1 = (x-1)(x+1)\) and \(x^2 + x = x(x+1)\). Cancel the common factor + \((x+1)\): + \[ \frac{(x-1)(x+1)}{x(x+1)} = \frac{x-1}{x}, \quad x \neq 0,\; x \neq -1. \] + The restrictions matter: at \(x = -1\) the original denominator is zero. +

+ +

Example. Simplify \(\dfrac{2x^2 - 8}{x^2 - 4}\).

+

+ \[ \frac{2(x^2-4)}{x^2-4} = \frac{2(x-2)(x+2)}{(x-2)(x+2)} = 2, \quad x \neq 2,\; x \neq -2. \] +

+ +

Adding and subtracting

+

+ Use a common denominator (the LCM of the denominators), as with numeric + fractions. +

+ +

Example. \(\dfrac{2}{x} + \dfrac{3}{x+1}\).

+

+ LCD is \(x(x+1)\): + \[ \frac{2}{x} + \frac{3}{x+1} = \frac{2(x+1) + 3x}{x(x+1)} = \frac{5x+2}{x(x+1)}, \quad x \neq 0,\; x \neq -1. \] +

+ +

Example. \(\dfrac{1}{x-2} - \dfrac{3}{x^2 - 4}\).

+

+ Note \(x^2 - 4 = (x-2)(x+2)\). With LCD \((x-2)(x+2)\): + \[ \frac{x+2}{(x-2)(x+2)} - \frac{3}{(x-2)(x+2)} = \frac{x-1}{(x-2)(x+2)}, \quad x \neq 2,\; x \neq -2. \] +

+ +

Multiplying and dividing

+

+ Multiply numerators and denominators; factorise before cancelling. To divide, multiply by the + reciprocal of the divisor. +

+ +
+

Divide

+

+ \[ \frac{A}{B} \div \frac{C}{D} = \frac{A}{B} \times \frac{D}{C} \] +

+
+ +

Example. \(\dfrac{x^2 - 9}{2x} \times \dfrac{4}{x+3}\).

+

+ \[ \frac{(x-3)(x+3)}{2x} \times \frac{4}{x+3} = \frac{4(x-3)}{2x} = \frac{2(x-3)}{x}, \quad x \neq 0,\; x \neq -3. \] +

+ +

Example. \(\dfrac{x^2 - 1}{x+1} \div \dfrac{x-1}{2}\).

+

+ \[ \frac{(x-1)(x+1)}{x+1} \times \frac{2}{x-1} = 2, \quad x \neq -1,\; x \neq 1. \] +

+ +

Harder examples

+

+ These use the same rules; the algebra is longer. Work factorisation and the LCD carefully. +

+ +

Example. \(\dfrac{1}{x} + \dfrac{1}{x+1}\) (already seen) gives + \(\dfrac{5x+2}{x(x+1)}\).

+ +

Example. Simplify \(\dfrac{x}{x^2 - 5x + 6}\).

+

+ Factorise \(x^2 - 5x + 6 = (x-2)(x-3)\): + \[ \frac{x}{(x-2)(x-3)}, \quad x \neq 2,\; x \neq 3. \] +

+ +

Changing the subject of a formula

+

+ A formula links several quantities. Changing the subject means + rewriting the formula so that one chosen letter stands alone on one side — like solving an + equation for that letter. +

+

+ Undo operations in reverse order to how they build the right-hand side: if the + target variable is multiplied, divide; if it is inside a bracket, expand or divide through; + if it appears in a denominator, multiply both sides by that denominator. +

+ +

Example. Make \(t\) the subject of \(v = \dfrac{d}{t}\) (\(t \neq 0\)).

+

+ Multiply both sides by \(t\): \(vt = d\). Divide by \(v\) (assuming \(v \neq 0\)): + \[ t = \frac{d}{v}. \] +

+ +

Example. Make \(A\) the subject of \(P = \dfrac{F}{A}\) (\(A \neq 0\)).

+

+ Multiply by \(A\): \(PA = F\), so \(A = \dfrac{F}{P}\) (\(P \neq 0\)). +

+ +

Example. Make \(R\) the subject of \(V = IR\).

+

+ Divide by \(I\) (assuming \(I \neq 0\)): \(R = \dfrac{V}{I}\). +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FormulaMeaning (typical units)
\(v = d/t\)speed = distance ÷ time
\(P = F/A\)pressure = force ÷ area
\(V = IR\)voltage = current × resistance
\(\rho = m/V\)density = mass ÷ volume
+
+
diff --git a/content/math/algebraic-fractions-formulas/supplement.html b/content/math/algebraic-fractions-formulas/supplement.html new file mode 100644 index 0000000..ae76ad9 --- /dev/null +++ b/content/math/algebraic-fractions-formulas/supplement.html @@ -0,0 +1,254 @@ +
+

History

+

+ For centuries, algebra was written in words. In the 16th and 17th centuries, mathematicians such + as François Viète began to use letters systematically for both unknowns and + known parameters. That made formulas — general relationships such as + \(v = d/t\) — easy to rearrange without repeating long verbal rules. +

+

+ Rational expressions (fractions built from polynomials) appear whenever you divide one polynomial + by another. Scientists from Galileo onward used ratios and proportionalities in + motion; later, Newton’s laws and electrical laws (e.g. \(V = IR\)) relied on + changing the subject of a formula to solve for the quantity you can measure. +

+

+ Today, algebraic fractions show up in simplifying models, in calculus limits, and whenever a + relationship is written as one quantity divided by another. +

+ +

Derivation

+ +

Why can we cancel a common factor?

+

+ If \(c \neq 0\), then \(\dfrac{ac}{bc} = \dfrac{a}{b}\) because multiplying numerator and + denominator by the same non-zero number does not change the value of a numeric fraction; the + same idea holds when \(c\) is a polynomial factor shared by top and bottom. +

+

+ You cannot cancel in \(\dfrac{a+c}{b+c}\) in general — that would mean, for example, + \(\dfrac{1+2}{3+2} = \dfrac{1}{3}\), which is false. Only factors, not + terms, may be cancelled. +

+ +

Why reverse the order of operations?

+

+ A formula like \(v = d/t\) builds \(v\) by first dividing \(d\) by \(t\). To recover \(t\), + undo division by multiplying: \(vt = d\), then undo multiplication by \(v\) (when \(v \neq 0\)) + to get \(t = d/v\). Each step reverses one operation that was applied to the subject you want. +

+ +

Checkpoints

+

+ Pause and reason before continuing. Discuss with a partner or write your work in a notebook. +

+ +
+

Checkpoint

+

+ Simplify \(\dfrac{x^2 - 4}{x + 2}\). What value of \(x\) must be excluded? +

+
+ +
+

Checkpoint

+

+ Can you cancel the \(x\) in \(\dfrac{x + 1}{x}\)? Explain briefly. +

+
+ +
+

Checkpoint

+

+ Write \(\dfrac{3}{x} - \dfrac{1}{2x}\) as a single fraction in simplest form. +

+
+ +
+

Checkpoint

+

+ Make \(d\) the subject of \(v = \dfrac{d}{t}\). State any conditions on \(t\) and \(v\). +

+
+ +
+

Checkpoint

+

+ A wire obeys \(V = IR\). If voltage and resistance are known, which formula gives current? +

+
+ +
+

Checkpoint

+

+ Simplify \(\dfrac{1}{x} + \dfrac{1}{x+1}\). What is the common denominator? +

+
+ +

Applications

+ +

Uniform motion

+

+ For constant speed, distance \(d\), speed \(v\), and time \(t\) are related by \(v = d/t\). If a + train travels \(240\) km in \(3\) h, then \(v = 240/3 = 80\) km/h. If you know \(v\) and \(t\) + but need distance, rearrange to \(d = vt\). +

+ +
+ +

Density

+

+ Density \(\rho\) (rho) is mass per unit volume: \(\rho = m/V\). A block of mass \(2.7\) kg with + volume \(0.001\) m³ has \(\rho = 2.7/0.001 = 2700\) kg/m³. To find mass from \(\rho\) and \(V\), + use \(m = \rho V\). +

+ +

Pressure and electric circuits

+

+ Pressure \(P = F/A\) links force \(F\) and area \(A\). Hydraulic and weather models often solve + for \(F = PA\). In a resistor, \(V = IR\) gives voltage from current and resistance; rearrange + to \(I = V/R\) when you know voltage and resistance. +

+ +
+ +

Question bank

+

+ Work each question, then open the solution to check your reasoning. Difficulty increases + through the sets. +

+ +

Easy

+ +
+ Simplify \(\dfrac{6x}{3x}\). +
+

Answer: \(2\), with \(x \neq 0\).

+

Steps: Cancel the common factor \(3x\).

+
+
+ +
+ Simplify \(\dfrac{x^2}{x}\) for \(x \neq 0\). +
+

Answer: \(x\).

+

Explanation: Cancel one factor \(x\) from numerator and denominator.

+
+
+ +
+ Make \(d\) the subject of \(v = d/t\). +
+

Answer: \(d = vt\) (\(t \neq 0\) when rearranging from the original).

+

Steps: Multiply both sides by \(t\).

+
+
+ +
+ Make \(R\) the subject of \(V = IR\). +
+

Answer: \(R = V/I\) (\(I \neq 0\)).

+

Steps: Divide both sides by \(I\).

+
+
+ +

Intermediate

+ +
+ Simplify \(\dfrac{x^2 - 9}{x + 3}\). +
+

Answer: \(x - 3\), with \(x \neq -3\).

+

Steps: \(x^2 - 9 = (x-3)(x+3)\); cancel \((x+3)\).

+
+
+ +
+ \(\dfrac{2}{x} + \dfrac{1}{x} = \) ______ +
+

Answer: \(\dfrac{3}{x}\), \(x \neq 0\).

+

Explanation: Same denominator already.

+
+
+ +
+ Simplify \(\dfrac{x^2 - 1}{x^2 + x}\). +
+

Answer: \(\dfrac{x-1}{x}\), \(x \neq 0,\; x \neq -1\).

+

Steps: Factorise; cancel \((x+1)\).

+
+
+ +
+ Make \(m\) the subject of \(\rho = m/V\). +
+

Answer: \(m = \rho V\) (\(V \neq 0\) in the original).

+

Steps: Multiply both sides by \(V\).

+
+
+ +

Difficult

+ +
+ \(\dfrac{1}{x} + \dfrac{2}{x+1} = \) ______ +
+

Answer: \(\dfrac{3x+1}{x(x+1)}\), \(x \neq 0,\; x \neq -1\).

+

Steps: LCD \(x(x+1)\); numerator \( (x+1) + 2x = 3x+1\).

+
+
+ +
+ \(\dfrac{x}{2} \times \dfrac{4}{x^2} = \) ______ +
+

Answer: \(\dfrac{2}{x}\), \(x \neq 0\).

+

Steps: Multiply; cancel a factor \(x\).

+
+
+ +
+ Simplify \(\dfrac{1}{x-2} - \dfrac{3}{x^2 - 4}\). +
+

Answer: \(\dfrac{x-1}{(x-2)(x+2)}\), \(x \neq 2,\; x \neq -2\).

+

Steps: Write \(x^2-4 = (x-2)(x+2)\); common denominator \((x-2)(x+2)\).

+
+
+ +

Hardcore

+ +
+ \(\dfrac{x^2 - 1}{x+1} \div \dfrac{x-1}{2} = \) ______ +
+

Answer: \(2\), with \(x \neq -1,\; x \neq 1\).

+

Steps: Factorise \(x^2-1\); multiply by reciprocal; cancel \((x-1)\) and \((x+1)\).

+
+
+ +
+ Make \(t\) the subject of \(v = \dfrac{d}{t}\) and then find \(t\) when \(d = 150\) km and \(v = 75\) km/h. +
+

Answer: \(t = d/v = 2\) h.

+

Steps: \(vt = d \Rightarrow t = d/v\); substitute values.

+
+
+ +
+ Simplify fully: \(\dfrac{2x^2 - 8}{x^2 - 4}\). +
+

Answer: \(2\), \(x \neq 2,\; x \neq -2\).

+

Steps: Factorise numerator \(2(x^2-4)\) and denominator \((x-2)(x+2)\); cancel \((x-2)(x+2)\).

+
+
+ +
+ A formula is \(P = \dfrac{F}{A}\). The force is \(120\) N and the area is \(0.05\) m². Find \(P\), then make \(F\) the subject and verify your force value. +
+

Answer: \(P = 120/0.05 = 2400\) Pa; \(F = PA = 2400 \times 0.05 = 120\) N.

+

Explanation: Rearranging checks that the formula is consistent.

+
+
+ +

References

+ +
diff --git a/content/math/algebraic-fractions-formulas/widgets/formula-rearrange-demo.tsx b/content/math/algebraic-fractions-formulas/widgets/formula-rearrange-demo.tsx new file mode 100644 index 0000000..2db9deb --- /dev/null +++ b/content/math/algebraic-fractions-formulas/widgets/formula-rearrange-demo.tsx @@ -0,0 +1,188 @@ +import katex from "katex"; +import { createMemo, createSignal, For } from "solid-js"; + +function renderLatex(latex: string, display = false) { + return katex.renderToString(latex, { + throwOnError: false, + strict: "ignore", + displayMode: display, + }); +} + +type FormulaId = "speed" | "density" | "ohm"; +type SubjectId = string; + +type FormulaDef = { + id: FormulaId; + label: string; + defaultSubject: SubjectId; + subjects: { id: SubjectId; label: string; result: string; steps: string[] }[]; +}; + +const FORMULAS: FormulaDef[] = [ + { + id: "speed", + label: "Speed — v = d/t", + defaultSubject: "t", + subjects: [ + { + id: "t", + label: "Make t the subject", + result: String.raw`t = \frac{d}{v}`, + steps: [ + String.raw`\text{Start: } v = \frac{d}{t}`, + String.raw`\text{Multiply both sides by } t \Rightarrow vt = d`, + String.raw`\text{Divide by } v \Rightarrow t = \frac{d}{v} \quad (v \neq 0)`, + ], + }, + { + id: "d", + label: "Make d the subject", + result: String.raw`d = vt`, + steps: [ + String.raw`\text{Start: } v = \frac{d}{t}`, + String.raw`\text{Multiply both sides by } t \Rightarrow d = vt`, + ], + }, + { + id: "v", + label: "Make v the subject", + result: String.raw`v = \frac{d}{t}`, + steps: [String.raw`\text{Already solved for } v \text{ ( } t \neq 0 \text{)}`], + }, + ], + }, + { + id: "density", + label: "Density — ρ = m/V", + defaultSubject: "m", + subjects: [ + { + id: "m", + label: "Make m the subject", + result: String.raw`m = \rho V`, + steps: [ + String.raw`\text{Start: } \rho = \frac{m}{V}`, + String.raw`\text{Multiply both sides by } V \Rightarrow m = \rho V`, + ], + }, + { + id: "V", + label: "Make V the subject", + result: String.raw`V = \frac{m}{\rho}`, + steps: [ + String.raw`\text{Start: } \rho = \frac{m}{V}`, + String.raw`\text{Multiply by } V,\ \text{divide by } \rho \Rightarrow V = \frac{m}{\rho} \quad (\rho \neq 0)`, + ], + }, + { + id: "rho", + label: "Make ρ the subject", + result: String.raw`\rho = \frac{m}{V}`, + steps: [String.raw`\text{Already solved for } \rho \text{ ( } V \neq 0 \text{)}`], + }, + ], + }, + { + id: "ohm", + label: "Voltage — V = IR", + defaultSubject: "R", + subjects: [ + { + id: "R", + label: "Make R the subject", + result: String.raw`R = \frac{V}{I}`, + steps: [ + String.raw`\text{Start: } V = IR`, + String.raw`\text{Divide both sides by } I \Rightarrow R = \frac{V}{I} \quad (I \neq 0)`, + ], + }, + { + id: "I", + label: "Make I the subject", + result: String.raw`I = \frac{V}{R}`, + steps: [ + String.raw`\text{Start: } V = IR`, + String.raw`\text{Divide both sides by } R \Rightarrow I = \frac{V}{R} \quad (R \neq 0)`, + ], + }, + { + id: "V", + label: "Make V the subject", + result: String.raw`V = IR`, + steps: [String.raw`\text{Already solved for } V`], + }, + ], + }, +]; + +function FormulaRearrangeDemo() { + const [formulaId, setFormulaId] = createSignal("speed"); + const [subjectId, setSubjectId] = createSignal("t"); + + const formula = createMemo(() => FORMULAS.find((f) => f.id === formulaId()) ?? FORMULAS[0]); + const subject = createMemo( + () => formula().subjects.find((s) => s.id === subjectId()) ?? formula().subjects[0] + ); + + const resultHtml = createMemo(() => renderLatex(subject().result, true)); + + const onFormulaChange = (id: FormulaId) => { + setFormulaId(id); + const f = FORMULAS.find((x) => x.id === id); + if (f) setSubjectId(f.defaultSubject); + }; + + return ( +
+
+
+ + +
+
+ + +
+
    + + {(step) => ( +
  1. +
    +
  2. + )} +
    +
+
+
+

+ Result: +

+
+
+
+ ); +} + +export default FormulaRearrangeDemo; diff --git a/content/math/algebraic-fractions-formulas/widgets/fraction-simplify-demo.tsx b/content/math/algebraic-fractions-formulas/widgets/fraction-simplify-demo.tsx new file mode 100644 index 0000000..77c29a0 --- /dev/null +++ b/content/math/algebraic-fractions-formulas/widgets/fraction-simplify-demo.tsx @@ -0,0 +1,97 @@ +import katex from "katex"; +import { createMemo, createSignal, For } from "solid-js"; + +function renderLatex(latex: string) { + return katex.renderToString(latex, { throwOnError: false, strict: "ignore", displayMode: true }); +} + +const PRESETS = [ + { + id: "difference-squares", + label: "Difference of squares", + original: String.raw`\frac{x^2 - 1}{x^2 + x}`, + factored: String.raw`\frac{(x-1)(x+1)}{x(x+1)}`, + simplified: String.raw`\frac{x-1}{x}`, + restriction: String.raw`x \neq 0,\; x \neq -1`, + }, + { + id: "common-factor", + label: "Common factor in numerator", + original: String.raw`\frac{2x^2 - 8}{x^2 - 4}`, + factored: String.raw`\frac{2(x-2)(x+2)}{(x-2)(x+2)}`, + simplified: String.raw`2`, + restriction: String.raw`x \neq 2,\; x \neq -2`, + }, + { + id: "quadratic-denom", + label: "Factorised quadratic denominator", + original: String.raw`\frac{x}{x^2 - 5x + 6}`, + factored: String.raw`\frac{x}{(x-2)(x-3)}`, + simplified: String.raw`\frac{x}{(x-2)(x-3)}`, + restriction: String.raw`x \neq 2,\; x \neq 3`, + }, +] as const; + +function FractionSimplifyDemo() { + const [presetId, setPresetId] = createSignal(PRESETS[0].id); + const preset = createMemo(() => PRESETS.find((p) => p.id === presetId()) ?? PRESETS[0]); + + const originalHtml = createMemo(() => renderLatex(preset().original)); + const factoredHtml = createMemo(() => renderLatex(preset().factored)); + const simplifiedHtml = createMemo(() => renderLatex(preset().simplified)); + const restrictionHtml = createMemo(() => + katex.renderToString(preset().restriction, { throwOnError: false, strict: "ignore" }) + ); + + return ( +
+
+
+ + +
+
    +
  1. + Original +
    +
  2. +
  3. + Factorise +
    +
  4. +
  5. + Cancel common factors +
    +
  6. +
+
+
+

+ Cancel only factors that appear in both numerator and denominator. +

+
+ Restrictions + + + +
+
+
+ ); +} + +export default FractionSimplifyDemo; diff --git a/content/math/counting-and-numbers/_index.md b/content/math/counting-and-numbers/_index.md new file mode 100644 index 0000000..fc0d8c1 --- /dev/null +++ b/content/math/counting-and-numbers/_index.md @@ -0,0 +1,646 @@ ++++ +title = "Counting and numbers" +description = "Count from zero, spot patterns, add, multiply, and divide; then meet place value and big numbers from hundreds to billions." +template = "chapter.html" +weight = 0 +[extra] +subject = "math" +chapter_id = "counting-and-numbers" +strand = "Number & Algebra" ++++ + +
+

+ Look around you. How many birds? How many cups? You can answer by + counting — pointing at one thing at a time until everything has been pointed at. + This chapter uses pictures of dots to stand for real things, like marbles or + fingers. +

+ +

What is counting?

+

+ To count is to touch (or point at) each object once. Say a word for each touch: + “one, two, three…” The last word tells you how many there are. +

+

+ Try it on your fingers: one finger up for each thing you counted. If every object has a finger, + the number of fingers matches the number of objects. +

+ +

Zero

+

+ When there is nothing to point at, we write 0 and say + zero. An empty plate, no toys in the box — zero dots: +

+

+ (none) +

+

Zero comes before one when we count: first nothing, then one, then two, and so on.

+ +
+

Remember

+

Zero means “none here,” not “forgot to count.”

+
+ +

Numbers 1 to 10

+

+ Each number has a digit (the symbol), a word, and a + picture of dots — one dot for each thing you counted. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DigitWordDots
1one
2two
3three
4four
5five
6six
7seven
8eight
9nine
10ten
+
+

Which group has more dots — the bigger picture wins:

+
+
+ 7 + + more +
+
+ 4 + + fewer +
+
+ +

Patterns

+

+ A pattern is when something repeats or grows the same way each time. You can + often guess what comes next if you look at the pictures. +

+ +

One more dot each time

+

Each step adds exactly one dot:

+
+
    +
  1. + 1 + +
  2. +
  3. + 2 + +
  4. +
  5. + 3 + +
  6. +
  7. + 4 + +
  8. +
  9. + 5 + +
  10. +
+
+ The pictures keep growing: 6 dots, then 7, all the way to 10 — one new dot every time. +
+
+ +

Two dots at a time (even numbers)

+

+ Even counts split into pairs with nothing left over. We jump two dots at a time: +

+
+
    +
  1. + 0 + none +
  2. +
  3. + 2 + + + +
  4. +
  5. + 4 + + + + +
  6. +
  7. + 6 + + + + + +
  8. +
  9. + 8 + + + + + + +
  10. +
  11. + 10 + + + + + + + +
  12. +
+
+ Each picture has one more pair of dots than the picture before. Every dot has a buddy. +
+
+ +

One extra dot (odd numbers)

+

+ Odd counts also grow by two dots each step, but there is always + one dot left alone — it does not fit in a pair. Look for the single dot in orange: +

+
+
    +
  1. + 1 + + + +
  2. +
  3. + 3 + + + + +
  4. +
  5. + 5 + + + + + +
  6. +
  7. + 7 + + + + + + +
  8. +
  9. + 9 + + + + + + + +
  10. +
+
+ The lonely dot stays while the pairs grow: next would be 11 — five pairs and + one dot by itself. +
+
+ +

Circle, square, circle, square…

+

Patterns can use shapes, not only dots. Watch the pictures repeat:

+
+
    +
  1. circle
  2. +
  3. square
  4. +
  5. circle
  6. +
  7. square
  8. +
  9. circle
  10. +
  11. square
  12. +
  13. + + next? +
  14. +
+
+ After a square comes a circle. The shapes take turns, over and over. +
+
+ +

Addition

+

+ Addition means putting two groups together. Three dots and four more dots make + seven dots in one big group. We write 3 + 4 = 7. +

+ +
+

Adding

+

Start with the first group, then place the second group beside it and count all the dots.

+
+ +

Multiplication

+

+ Multiplication is many equal groups. Three bags with two sweets each + is the same as three pairs of dots. We write 3 × 2 = 6 — “three groups of two.” +

+

+ You can lay the dots in a rectangle: 3 rows with 2 dots in each row fills a + block of 6 dots. +

+ +

Division

+

+ Division is about sharing equally or making equal groups. If + 12 biscuits are shared among 4 friends, each friend gets the same number. We write + 12 ÷ 4 = 3 — “twelve split into four equal piles gives three in each pile.” +

+

+ Division is the partner of multiplication. If 3 × 4 = 12, then + 12 ÷ 3 = 4 and 12 ÷ 4 = 3. One picture of dots can answer both + kinds of question. +

+ +
+

Fair shares

+

+ When every pile has the same number of dots, the share is fair. If dots are + left over, the total does not split evenly — those extras are the remainder. +

+
+ +
+ +

Past ten: tens and hundreds

+

+ You can count higher than ten on your fingers — people use place value. Ten + single dots can be thought of as one group of ten. Ten groups of ten make + one hundred. +

+
+
    +
  1. + 1 one + +
  2. + +
  3. + 1 ten + +
  4. + +
  5. + 1 hundred + +
  6. +
+
+ Each step bundles ten of the smaller unit. That is why our digits work in columns (ones, tens, + hundreds…). +
+
+

+ The number 47 means 4 tens and 7 ones — forty-seven dots, without drawing every + dot one by one. +

+ +

Big numbers in real life

+

+ The world is huge. Counting every grain of sand on a beach one by one would take forever, so we + use big number words to talk about amounts we cannot easily picture dot by dot. + They matter because governments, scientists, and shops all work with large totals. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
WordHow we write itWhy it matters
hundred100About how many people fit in a big sports field; pages in a long novel.
thousand1,000Steps you might walk in a long hike; students in a large school district.
million1,000,000People in a large city; dollars in a national budget line item.
billion1,000,000,000World population is several billion; stars in our galaxy are hundreds of billions.
+
+ +

+ Each big word is one thousand times the word before (ten hundreds make a + thousand; one thousand thousands make a million). We bundle in tens and thousands so we can + compare and add without losing track. +

+ +
    +
  • Money — prices and taxes use thousands and millions.
  • +
  • Distance — kilometres between cities add up to thousands.
  • +
  • Time — minutes in a year are in the hundreds of thousands.
  • +
  • Nature — insects in a forest, cells in your body — counts go huge fast.
  • +
+ +
+ +

Try it yourself

+

+ Use the tools below: count dots, add and multiply, share equally, and zoom from + one dot up to a billion to see how big numbers compare. +

+
+ +
+
+
+ +
+

History

+

+ Long before writing, people kept track of herds, harvests, and trade by making marks — tallies — + one mark for each item. Archaeologists have found tally bones tens of thousands of years old. +

+

+ Different cultures invented symbols for amounts. The idea of zero as a number took + time: Indian mathematicians such as Brahmagupta (7th century CE) wrote rules for + arithmetic that included zero. The Maya used a shell sign for zero in their calendar. Zero let + people write “none” clearly and build place-value systems later on. +

+

+ Multiplication grew from repeated addition in trade and land measurement — counting equal rows of + goods or fields without adding one row at a time forever. +

+

+ Division appears in sharing problems as old as fair trade: split grain, land, or money into equal + parts. Large-number names (million, billion) expanded as empires, astronomy, and finance needed to + record bigger totals than everyday counting. +

+ +

Derivation

+ +

Why addition combines groups

+

+ Suppose the first group has \(a\) objects and the second has \(b\) objects, with no overlap. If + you put them in one pile and count from the start, you say \(a\) number words for the first + group, then continue with \(b\) more words. The last word is the total \(a + b\). That is why + \(3 + 4 = 7\): three objects, then four more, gives seven in all. +

+ +

Multiplication as repeated addition

+

+ If there are \(r\) equal rows and each row has \(c\) dots, you can add + \(c + c + \cdots + c\) (\(r\) times) to get the total. Writing \(r \times c\) saves repeating + the same addition. For example, \(4 \times 3 = 3 + 3 + 3 + 3 = 12\). +

+ +

Division as fair sharing

+

+ If \(T\) dots are split into \(g\) equal piles with nothing left over, each pile has + \(T \div g\) dots. That is the same as asking: what number times \(g\) gives \(T\)? So + \(T \div g = q\) when \(g \times q = T\). Example: \(12 \div 4 = 3\) because \(4 \times 3 = 12\). +

+ +

Place value and big numbers

+

+ In base ten, each column is worth ten times the column to its right. So \(47 = 4 \times 10 + 7\). + Extending the pattern: \(1{,}000 = 10^3\), \(1{,}000{,}000 = 10^6\), and each “thousand step” multiplies + by \(1{,}000\) again. That is why we group digits in threes when writing millions and billions. +

+ +

Checkpoints

+

Pause and answer in your head or with a partner before moving on.

+ +
+

Checkpoint

+

Show the number \(7\) on your fingers. What digit symbol matches seven?

+
+ +
+

Checkpoint

+

Which is greater: \(5\) or \(9\)? How do you know?

+
+ +
+

Checkpoint

+

Is \(2 + 2 + 2\) the same total as \(3 \times 2\)? Explain with a picture of dots.

+
+ +
+

Checkpoint

+

What comes next in the pattern \(2, 4, 6, 8, \ldots\)?

+
+ +
+

Checkpoint

+

Share 15 dots into 3 equal piles. How many in each pile? What if you try 4 piles?

+
+ +
+

Checkpoint

+

Which is bigger: 1 million or 1 thousand? How do you know?

+
+ +

Real-life applications

+
    +
  • Sharing snacks — \(6\) biscuits shared among \(3\) friends is \(6 \div 3 = 2\) each; check with \(3 \times 2 = 6\).
  • +
  • Rows of chairs — a room with \(4\) rows of \(5\) chairs has \(4 \times 5 = 20\) seats.
  • +
  • Egg cartons — two rows of \(5\) cups hold \(2 \times 5 = 10\) eggs.
  • +
  • Counting steps — climbing \(8\) steps then \(2\) more is \(8 + 2 = 10\) steps.
  • +
  • Population — countries and cities are counted in millions or billions.
  • +
  • Packaging — eggs in cartons (\(2 \times 5\)) and sweets split among friends (\(12 \div 4\)).
  • +
+ +

Question bank

+ +

Easy

+ +
+ How many fingers on one hand? +
+

Answer: \(5\).

+
+
+ +
+ What digit means “none”? +
+

Answer: \(0\) (zero).

+
+
+ +
+ Compute \(2 + 5\). +
+

Answer: \(7\).

+

Steps: Two objects plus five more gives seven.

+
+
+ +

Intermediate

+ +
+ Compute \(6 + 4\). +
+

Answer: \(10\).

+
+
+ +
+ Compute \(3 \times 4\). +
+

Answer: \(12\).

+

Steps: \(4 + 4 + 4 = 12\), or four rows of three dots.

+
+
+ +
+ Which is larger: \(8\) or \(6\)? +
+

Answer: \(8\) is larger.

+
+
+ +

Difficult

+ +
+ Compute \(5 + 3 + 2\). +
+

Answer: \(10\).

+

Steps: \(5 + 3 = 8\), then \(8 + 2 = 10\).

+
+
+ +
+ A tray has \(3\) rows of \(3\) muffins. How many muffins? +
+

Answer: \(9\).

+

Steps: \(3 \times 3 = 9\).

+
+
+ +

Hardcore

+ +
+ Without counting one by one: if \(7 + 3 = 10\), what is \(3 + 7\)? Why? +
+

Answer: \(10\).

+

Explanation: Addition of whole numbers can be done in either order (commutative property).

+
+
+ +
+ Show \(5 \times 2\) as both repeated addition and as a dot rectangle. +
+

Answer: \(10\).

+

Steps: \(2 + 2 + 2 + 2 + 2 = 10\); five rows of two dots (or two columns of five).

+
+
+ +
+ Share \(12\) dots equally among \(4\) piles. How many per pile? +
+

Answer: \(3\) per pile.

+

Steps: \(12 \div 4 = 3\) because \(4 \times 3 = 12\).

+
+
+ +
+ How many zeros are in one million written in digits? +
+

Answer: Six zeros: 1,000,000.

+
+
+ +

References

+
    +
  • Ifrah, Georges — The Universal History of Numbers (origins of counting and zero).
  • +
  • Crossley & Henry — early Indian arithmetic including zero.
  • +
+
diff --git a/content/math/counting-and-numbers/chapter.scss b/content/math/counting-and-numbers/chapter.scss new file mode 100644 index 0000000..915a5f2 --- /dev/null +++ b/content/math/counting-and-numbers/chapter.scss @@ -0,0 +1,707 @@ +// Figurative dots and patterns in chapter prose +.counting-dots { + display: inline-flex; + flex-wrap: wrap; + align-items: center; + gap: 5px; + vertical-align: middle; +} + +.counting-dots__dot { + display: block; + width: 12px; + height: 12px; + border-radius: 50%; + background: #0f766e; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12); + flex-shrink: 0; +} + +.counting-dots--empty .counting-dots__none { + font-size: 0.85rem; + font-style: italic; + color: var(--muted); +} + +.counting-dots--compare { + max-width: 100px; +} + +.counting-dots--pair { + display: inline-flex; + flex-wrap: wrap; + gap: 8px; + max-width: 200px; +} + +.counting-dots__pair { + display: inline-flex; + gap: 4px; + padding: 4px 6px; + border-radius: 6px; + background: rgba(20, 184, 166, 0.12); + border: 1px dashed rgba(15, 118, 110, 0.35); +} + +.counting-dots--odd { + display: inline-flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; + max-width: 220px; +} + +.counting-dots__singleton { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 4px 8px; + border-radius: 6px; + background: rgba(234, 88, 12, 0.14); + border: 2px solid rgba(180, 83, 9, 0.45); +} + +.counting-dots__singleton .counting-dots__dot { + background: #c2410c; +} + +.counting-pattern-ladder--odd .counting-pattern-step { + background: rgba(234, 88, 12, 0.06); +} + +.counting-number-table td:last-child { + min-width: 110px; +} + +.counting-compare { + display: flex; + flex-wrap: wrap; + gap: 24px; + justify-content: center; + margin: 20px 0; + padding: 16px; + border: 1px solid var(--line); + border-radius: 12px; + background: var(--card-bg); +} + +.counting-compare__group { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; +} + +.counting-compare__digit { + font-family: var(--mono); + font-size: 1.25rem; + font-weight: 700; +} + +.counting-compare__word { + font-size: 0.8rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.06em; + color: var(--soft-ink); +} + +.counting-pattern-board { + margin: 20px 0; + padding: 16px 18px; + border: 1px solid var(--line); + border-radius: 12px; + background: var(--card-bg); +} + +.counting-pattern-ladder { + display: flex; + flex-wrap: wrap; + gap: 14px 18px; + margin: 0; + padding: 0; + list-style: none; +} + +.counting-pattern-step { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; + min-width: 56px; + padding: 10px 8px; + border-radius: 8px; + background: rgba(20, 184, 166, 0.06); +} + +.counting-pattern-step__digit { + font-family: var(--mono); + font-size: 1.1rem; + font-weight: 700; + color: var(--ink); +} + +.counting-pattern-board__caption { + margin: 14px 0 0; + font-size: 0.9rem; + color: var(--soft-ink); + text-align: center; +} + +.counting-shape-pattern { + margin: 20px 0; + padding: 16px 18px; + border: 1px solid var(--line); + border-radius: 12px; + background: var(--card-bg); +} + +.counting-shape-pattern__strip { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 12px 16px; + margin: 0; + padding: 0; + list-style: none; +} + +.counting-shape-pattern__strip > li { + display: flex; + flex-direction: column; + align-items: center; + gap: 6px; +} + +.counting-shape { + display: block; + width: 36px; + height: 36px; +} + +.counting-shape--circle { + border-radius: 50%; + background: rgba(59, 130, 246, 0.45); + border: 2px solid rgba(37, 99, 235, 0.5); +} + +.counting-shape--square { + border-radius: 4px; + background: rgba(234, 179, 8, 0.45); + border: 2px solid rgba(180, 83, 9, 0.45); +} + +.counting-shape--question { + display: flex; + align-items: center; + justify-content: center; + border-radius: 8px; + border: 2px dashed var(--line); + font-family: var(--mono); + font-size: 1.25rem; + font-weight: 700; + color: var(--muted); + background: transparent; +} + +.counting-shape-pattern__label { + font-size: 0.72rem; + color: var(--soft-ink); + text-transform: lowercase; +} + +.counting-shape-pattern__next .counting-shape-pattern__label { + font-weight: 600; + color: var(--accent); +} + +.counting-demo__objects { + display: flex; + flex-wrap: wrap; + gap: 10px; + min-height: 88px; + padding: 16px; + border: 1px dashed var(--line); + border-radius: 10px; + background: var(--card-bg); +} + +.counting-demo__object { + width: 40px; + height: 40px; + border: none; + border-radius: 50%; + background: rgba(20, 184, 166, 0.35); + cursor: pointer; + transition: transform 0.12s ease, background 0.12s ease; +} + +.counting-demo__object:hover { + transform: scale(1.06); + background: rgba(20, 184, 166, 0.55); +} + +.counting-demo__object--active { + background: rgba(15, 118, 110, 0.75); +} + +.counting-demo__count { + font-family: var(--mono); + font-size: 2rem; + font-weight: 700; + color: var(--ink); +} + +.addition-groups__piles { + display: flex; + flex-wrap: wrap; + align-items: flex-end; + justify-content: center; + gap: 20px; +} + +.addition-groups__pile { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; +} + +.addition-groups__dots { + display: flex; + flex-wrap: wrap; + gap: 6px; + justify-content: center; + width: 140px; + min-height: 100px; + padding: 10px; + border-radius: 8px; + background: rgba(59, 130, 246, 0.08); +} + +.addition-groups__pile--b .addition-groups__dots { + background: rgba(154, 107, 46, 0.12); +} + +.addition-groups__dot { + width: 14px; + height: 14px; + border-radius: 50%; + background: var(--ink); +} + +.addition-groups__plus, +.addition-groups__equals { + font-family: var(--mono); + font-size: 1.5rem; + font-weight: 700; + color: var(--soft-ink); +} + +.addition-groups__total-dots { + display: flex; + flex-wrap: wrap; + gap: 5px; + justify-content: center; + max-width: 320px; + min-height: 48px; + margin-top: 12px; +} + +.multiplication-array__grid { + display: grid; + gap: 6px; + width: fit-content; + margin: 0 auto; + padding: 12px; + border-radius: 10px; + background: var(--card-bg); + border: 1px solid var(--line); +} + +.multiplication-array__cell { + width: 22px; + height: 22px; + border-radius: 50%; + background: rgba(20, 184, 166, 0.45); +} + +// Place value ladder (prose) +.counting-place-ladder { + margin: 20px 0; + padding: 16px 18px; + border: 1px solid var(--line); + border-radius: 12px; + background: var(--card-bg); +} + +.counting-place-ladder__steps { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + gap: 12px 16px; + margin: 0; + padding: 0; + list-style: none; +} + +.counting-place-step { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; +} + +.counting-place-step--arrow { + font-family: var(--mono); + font-size: 0.9rem; + font-weight: 700; + color: var(--soft-ink); +} + +.counting-place-step__label { + font-size: 0.8rem; + font-weight: 600; + color: var(--soft-ink); +} + +.counting-place-blocks__rod { + display: block; + width: 14px; + height: 72px; + border-radius: 4px; + background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%); +} + +.counting-place-blocks__grid { + display: block; + width: 72px; + height: 72px; + border-radius: 6px; + background: + repeating-linear-gradient( + 90deg, + rgba(15, 118, 110, 0.35) 0, + rgba(15, 118, 110, 0.35) 6px, + transparent 6px, + transparent 12px + ), + repeating-linear-gradient( + rgba(15, 118, 110, 0.35) 0, + rgba(15, 118, 110, 0.35) 6px, + transparent 6px, + transparent 12px + ); + border: 2px solid rgba(15, 118, 110, 0.5); +} + +.counting-big-table td:first-child { + font-weight: 600; +} + +// Division sharing widget +.division-sharing__equation { + margin: 12px 0; + font-family: var(--mono); + font-size: 1.05rem; + text-align: center; +} + +.division-sharing__piles { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 14px; +} + +.division-sharing__pile { + display: flex; + flex-direction: column; + align-items: center; + gap: 6px; +} + +.division-sharing__pile-label { + font-size: 0.75rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--soft-ink); +} + +.division-sharing__dots { + display: flex; + flex-wrap: wrap; + gap: 5px; + justify-content: center; + width: 88px; + min-height: 72px; + padding: 8px; + border-radius: 8px; + background: rgba(59, 130, 246, 0.08); +} + +.division-sharing__dot { + width: 12px; + height: 12px; + border-radius: 50%; + background: var(--ink); +} + +.division-sharing__dot--extra { + background: #c2410c; +} + +.division-sharing__dots--remainder { + background: rgba(234, 88, 12, 0.1); + border: 1px dashed rgba(180, 83, 9, 0.45); +} + +.division-sharing__uneven { + display: flex; + flex-wrap: wrap; + align-items: flex-end; + justify-content: center; + gap: 16px; +} + +.division-sharing__remainder { + display: flex; + flex-direction: column; + align-items: center; + gap: 6px; +} + +// Big numbers scale widget +.big-numbers-scale__picker { + display: flex; + flex-wrap: wrap; + gap: 8px; + justify-content: center; +} + +.big-numbers-scale__btn { + padding: 6px 12px; + border: 1px solid var(--line); + border-radius: 8px; + font-family: var(--mono); + font-size: 0.8rem; + background: var(--card-bg); + color: var(--ink); + cursor: pointer; +} + +.big-numbers-scale__btn--active { + border-color: #0f766e; + background: rgba(20, 184, 166, 0.15); + font-weight: 700; +} + +.big-numbers-scale__display { + margin: 16px 0 8px; + text-align: center; +} + +.big-numbers-scale__number { + font-family: var(--mono); + font-size: 2rem; + font-weight: 700; +} + +.big-numbers-scale__compare { + margin: 0 0 12px; + font-size: 0.9rem; + text-align: center; + color: var(--soft-ink); +} + +.big-numbers-scale__visual { + display: flex; + justify-content: center; + min-height: 120px; + margin: 12px 0; + padding: 16px; + border: 1px dashed var(--line); + border-radius: 10px; + background: var(--card-bg); +} + +.big-numbers-scale__grid { + display: grid; + gap: 4px; +} + +.big-numbers-scale__grid--small .big-numbers-scale__cell { + width: 6px; + height: 6px; +} + +.big-numbers-scale__cell { + width: 10px; + height: 10px; + border-radius: 50%; + background: #0f766e; +} + +.big-numbers-scale__blocks { + display: flex; + flex-wrap: wrap; + gap: 6px; + justify-content: center; + max-width: 280px; +} + +.big-numbers-scale__block { + padding: 6px 8px; + border-radius: 4px; + font-family: var(--mono); + font-size: 0.65rem; + font-weight: 700; + background: rgba(20, 184, 166, 0.2); + border: 1px solid rgba(15, 118, 110, 0.35); +} + +.big-numbers-scale__block--hundred { + min-width: 36px; + text-align: center; +} + +.big-numbers-scale__visual-caption { + flex: 1 1 100%; + margin: 10px 0 0; + font-size: 0.82rem; + line-height: 1.45; + text-align: center; + color: var(--soft-ink); +} + +.big-numbers-scale__visual-caption--inline { + margin: 8px 0 0; +} + +.big-numbers-scale__math-hint { + font-family: var(--mono); + font-size: 0.85em; +} + +// 1 million: 100 × 10,000 +.big-numbers-scale__million { + width: 100%; +} + +.big-numbers-scale__mega-grid { + display: grid; + grid-template-columns: repeat(10, 1fr); + gap: 3px; + max-width: 280px; + margin: 0 auto; +} + +.big-numbers-scale__mega-cell { + display: flex; + align-items: center; + justify-content: center; + min-height: 22px; + border-radius: 3px; + font-family: var(--mono); + font-size: 0.5rem; + font-weight: 700; + color: #0f766e; + background: rgba(20, 184, 166, 0.22); + border: 1px solid rgba(15, 118, 110, 0.35); +} + +// 1 billion: mini million × 1000 → grid of 1M +.big-numbers-scale__billion { + width: 100%; +} + +.big-numbers-scale__billion-compare { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + gap: 10px 14px; +} + +.big-numbers-scale__billion-unit { + display: flex; + flex-direction: column; + align-items: center; + gap: 6px; + padding: 8px; + border-radius: 8px; + background: rgba(20, 184, 166, 0.06); + border: 1px solid var(--line); +} + +.big-numbers-scale__billion-unit--wide { + flex: 1 1 200px; + max-width: 320px; + background: rgba(234, 88, 12, 0.06); + border-color: rgba(180, 83, 9, 0.35); +} + +.big-numbers-scale__billion-unit-label { + font-size: 0.72rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--soft-ink); +} + +.big-numbers-scale__mini-grid { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 2px; +} + +.big-numbers-scale__mini-cell { + display: flex; + align-items: center; + justify-content: center; + width: 28px; + height: 18px; + border-radius: 2px; + font-family: var(--mono); + font-size: 0.45rem; + font-weight: 700; + color: #0f766e; + background: rgba(20, 184, 166, 0.25); +} + +.big-numbers-scale__billion-times { + font-family: var(--mono); + font-size: 1rem; + font-weight: 700; + color: var(--accent); +} + +.big-numbers-scale__billion-equals { + font-family: var(--mono); + font-size: 1.25rem; + font-weight: 700; + color: var(--muted); +} + +.big-numbers-scale__giga-grid { + display: grid; + grid-template-columns: repeat(10, 1fr); + gap: 2px; + width: 100%; +} + +.big-numbers-scale__giga-cell { + display: flex; + align-items: center; + justify-content: center; + min-height: 18px; + border-radius: 2px; + font-family: var(--mono); + font-size: 0.48rem; + font-weight: 700; + color: #9a3412; + background: rgba(234, 88, 12, 0.28); + border: 1px solid rgba(180, 83, 9, 0.4); +} diff --git a/content/math/counting-and-numbers/core.html b/content/math/counting-and-numbers/core.html new file mode 100644 index 0000000..2efca34 --- /dev/null +++ b/content/math/counting-and-numbers/core.html @@ -0,0 +1,431 @@ +
+

+ Look around you. How many birds? How many cups? You can answer by + counting — pointing at one thing at a time until everything has been pointed at. + This chapter uses pictures of dots to stand for real things, like marbles or + fingers. +

+ +

What is counting?

+

+ To count is to touch (or point at) each object once. Say a word for each touch: + “one, two, three…” The last word tells you how many there are. +

+

+ Try it on your fingers: one finger up for each thing you counted. If every object has a finger, + the number of fingers matches the number of objects. +

+ +

Zero

+

+ When there is nothing to point at, we write 0 and say + zero. An empty plate, no toys in the box — zero dots: +

+

+ (none) +

+

Zero comes before one when we count: first nothing, then one, then two, and so on.

+ +
+

Remember

+

Zero means “none here,” not “forgot to count.”

+
+ +

Numbers 1 to 10

+

+ Each number has a digit (the symbol), a word, and a + picture of dots — one dot for each thing you counted. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DigitWordDots
1one
2two
3three
4four
5five
6six
7seven
8eight
9nine
10ten
+
+

Which group has more dots — the bigger picture wins:

+
+
+ 7 + + more +
+
+ 4 + + fewer +
+
+ +

Patterns

+

+ A pattern is when something repeats or grows the same way each time. You can + often guess what comes next if you look at the pictures. +

+ +

One more dot each time

+

Each step adds exactly one dot:

+
+
    +
  1. + 1 + +
  2. +
  3. + 2 + +
  4. +
  5. + 3 + +
  6. +
  7. + 4 + +
  8. +
  9. + 5 + +
  10. +
+
+ The pictures keep growing: 6 dots, then 7, all the way to 10 — one new dot every time. +
+
+ +

Two dots at a time (even numbers)

+

+ Even counts split into pairs with nothing left over. We jump two dots at a time: +

+
+
    +
  1. + 0 + none +
  2. +
  3. + 2 + + + +
  4. +
  5. + 4 + + + + +
  6. +
  7. + 6 + + + + + +
  8. +
  9. + 8 + + + + + + +
  10. +
  11. + 10 + + + + + + + +
  12. +
+
+ Each picture has one more pair of dots than the picture before. Every dot has a buddy. +
+
+ +

One extra dot (odd numbers)

+

+ Odd counts also grow by two dots each step, but there is always + one dot left alone — it does not fit in a pair. Look for the single dot in orange: +

+
+
    +
  1. + 1 + + + +
  2. +
  3. + 3 + + + + +
  4. +
  5. + 5 + + + + + +
  6. +
  7. + 7 + + + + + + +
  8. +
  9. + 9 + + + + + + + +
  10. +
+
+ The lonely dot stays while the pairs grow: next would be 11 — five pairs and + one dot by itself. +
+
+ +

Circle, square, circle, square…

+

Patterns can use shapes, not only dots. Watch the pictures repeat:

+
+
    +
  1. circle
  2. +
  3. square
  4. +
  5. circle
  6. +
  7. square
  8. +
  9. circle
  10. +
  11. square
  12. +
  13. + + next? +
  14. +
+
+ After a square comes a circle. The shapes take turns, over and over. +
+
+ +

Addition

+

+ Addition means putting two groups together. Three dots and four more dots make + seven dots in one big group. We write 3 + 4 = 7. +

+ +
+

Adding

+

Start with the first group, then place the second group beside it and count all the dots.

+
+ +

Multiplication

+

+ Multiplication is many equal groups. Three bags with two sweets each + is the same as three pairs of dots. We write 3 × 2 = 6 — “three groups of two.” +

+

+ You can lay the dots in a rectangle: 3 rows with 2 dots in each row fills a + block of 6 dots. +

+ +

Division

+

+ Division is about sharing equally or making equal groups. If + 12 biscuits are shared among 4 friends, each friend gets the same number. We write + 12 ÷ 4 = 3 — “twelve split into four equal piles gives three in each pile.” +

+

+ Division is the partner of multiplication. If 3 × 4 = 12, then + 12 ÷ 3 = 4 and 12 ÷ 4 = 3. One picture of dots can answer both + kinds of question. +

+ +
+

Fair shares

+

+ When every pile has the same number of dots, the share is fair. If dots are + left over, the total does not split evenly — those extras are the remainder. +

+
+ +
+ +

Past ten: tens and hundreds

+

+ You can count higher than ten on your fingers — people use place value. Ten + single dots can be thought of as one group of ten. Ten groups of ten make + one hundred. +

+
+
    +
  1. + 1 one + +
  2. + +
  3. + 1 ten + +
  4. + +
  5. + 1 hundred + +
  6. +
+
+ Each step bundles ten of the smaller unit. That is why our digits work in columns (ones, tens, + hundreds…). +
+
+

+ The number 47 means 4 tens and 7 ones — forty-seven dots, without drawing every + dot one by one. +

+ +

Big numbers in real life

+

+ The world is huge. Counting every grain of sand on a beach one by one would take forever, so we + use big number words to talk about amounts we cannot easily picture dot by dot. + They matter because governments, scientists, and shops all work with large totals. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
WordHow we write itWhy it matters
hundred100About how many people fit in a big sports field; pages in a long novel.
thousand1,000Steps you might walk in a long hike; students in a large school district.
million1,000,000People in a large city; dollars in a national budget line item.
billion1,000,000,000World population is several billion; stars in our galaxy are hundreds of billions.
+
+ +

+ Each big word is one thousand times the word before (ten hundreds make a + thousand; one thousand thousands make a million). We bundle in tens and thousands so we can + compare and add without losing track. +

+ +
    +
  • Money — prices and taxes use thousands and millions.
  • +
  • Distance — kilometres between cities add up to thousands.
  • +
  • Time — minutes in a year are in the hundreds of thousands.
  • +
  • Nature — insects in a forest, cells in your body — counts go huge fast.
  • +
+ +
+ +

Try it yourself

+

+ Use the tools below: count dots, add and multiply, share equally, and zoom from + one dot up to a billion to see how big numbers compare. +

+
+ +
+
+
diff --git a/content/math/counting-and-numbers/supplement.html b/content/math/counting-and-numbers/supplement.html new file mode 100644 index 0000000..8257ef1 --- /dev/null +++ b/content/math/counting-and-numbers/supplement.html @@ -0,0 +1,203 @@ +
+

History

+

+ Long before writing, people kept track of herds, harvests, and trade by making marks — tallies — + one mark for each item. Archaeologists have found tally bones tens of thousands of years old. +

+

+ Different cultures invented symbols for amounts. The idea of zero as a number took + time: Indian mathematicians such as Brahmagupta (7th century CE) wrote rules for + arithmetic that included zero. The Maya used a shell sign for zero in their calendar. Zero let + people write “none” clearly and build place-value systems later on. +

+

+ Multiplication grew from repeated addition in trade and land measurement — counting equal rows of + goods or fields without adding one row at a time forever. +

+

+ Division appears in sharing problems as old as fair trade: split grain, land, or money into equal + parts. Large-number names (million, billion) expanded as empires, astronomy, and finance needed to + record bigger totals than everyday counting. +

+ +

Derivation

+ +

Why addition combines groups

+

+ Suppose the first group has \(a\) objects and the second has \(b\) objects, with no overlap. If + you put them in one pile and count from the start, you say \(a\) number words for the first + group, then continue with \(b\) more words. The last word is the total \(a + b\). That is why + \(3 + 4 = 7\): three objects, then four more, gives seven in all. +

+ +

Multiplication as repeated addition

+

+ If there are \(r\) equal rows and each row has \(c\) dots, you can add + \(c + c + \cdots + c\) (\(r\) times) to get the total. Writing \(r \times c\) saves repeating + the same addition. For example, \(4 \times 3 = 3 + 3 + 3 + 3 = 12\). +

+ +

Division as fair sharing

+

+ If \(T\) dots are split into \(g\) equal piles with nothing left over, each pile has + \(T \div g\) dots. That is the same as asking: what number times \(g\) gives \(T\)? So + \(T \div g = q\) when \(g \times q = T\). Example: \(12 \div 4 = 3\) because \(4 \times 3 = 12\). +

+ +

Place value and big numbers

+

+ In base ten, each column is worth ten times the column to its right. So \(47 = 4 \times 10 + 7\). + Extending the pattern: \(1{,}000 = 10^3\), \(1{,}000{,}000 = 10^6\), and each “thousand step” multiplies + by \(1{,}000\) again. That is why we group digits in threes when writing millions and billions. +

+ +

Checkpoints

+

Pause and answer in your head or with a partner before moving on.

+ +
+

Checkpoint

+

Show the number \(7\) on your fingers. What digit symbol matches seven?

+
+ +
+

Checkpoint

+

Which is greater: \(5\) or \(9\)? How do you know?

+
+ +
+

Checkpoint

+

Is \(2 + 2 + 2\) the same total as \(3 \times 2\)? Explain with a picture of dots.

+
+ +
+

Checkpoint

+

What comes next in the pattern \(2, 4, 6, 8, \ldots\)?

+
+ +
+

Checkpoint

+

Share 15 dots into 3 equal piles. How many in each pile? What if you try 4 piles?

+
+ +
+

Checkpoint

+

Which is bigger: 1 million or 1 thousand? How do you know?

+
+ +

Real-life applications

+
    +
  • Sharing snacks — \(6\) biscuits shared among \(3\) friends is \(6 \div 3 = 2\) each; check with \(3 \times 2 = 6\).
  • +
  • Rows of chairs — a room with \(4\) rows of \(5\) chairs has \(4 \times 5 = 20\) seats.
  • +
  • Egg cartons — two rows of \(5\) cups hold \(2 \times 5 = 10\) eggs.
  • +
  • Counting steps — climbing \(8\) steps then \(2\) more is \(8 + 2 = 10\) steps.
  • +
  • Population — countries and cities are counted in millions or billions.
  • +
  • Packaging — eggs in cartons (\(2 \times 5\)) and sweets split among friends (\(12 \div 4\)).
  • +
+ +

Question bank

+ +

Easy

+ +
+ How many fingers on one hand? +
+

Answer: \(5\).

+
+
+ +
+ What digit means “none”? +
+

Answer: \(0\) (zero).

+
+
+ +
+ Compute \(2 + 5\). +
+

Answer: \(7\).

+

Steps: Two objects plus five more gives seven.

+
+
+ +

Intermediate

+ +
+ Compute \(6 + 4\). +
+

Answer: \(10\).

+
+
+ +
+ Compute \(3 \times 4\). +
+

Answer: \(12\).

+

Steps: \(4 + 4 + 4 = 12\), or four rows of three dots.

+
+
+ +
+ Which is larger: \(8\) or \(6\)? +
+

Answer: \(8\) is larger.

+
+
+ +

Difficult

+ +
+ Compute \(5 + 3 + 2\). +
+

Answer: \(10\).

+

Steps: \(5 + 3 = 8\), then \(8 + 2 = 10\).

+
+
+ +
+ A tray has \(3\) rows of \(3\) muffins. How many muffins? +
+

Answer: \(9\).

+

Steps: \(3 \times 3 = 9\).

+
+
+ +

Hardcore

+ +
+ Without counting one by one: if \(7 + 3 = 10\), what is \(3 + 7\)? Why? +
+

Answer: \(10\).

+

Explanation: Addition of whole numbers can be done in either order (commutative property).

+
+
+ +
+ Show \(5 \times 2\) as both repeated addition and as a dot rectangle. +
+

Answer: \(10\).

+

Steps: \(2 + 2 + 2 + 2 + 2 = 10\); five rows of two dots (or two columns of five).

+
+
+ +
+ Share \(12\) dots equally among \(4\) piles. How many per pile? +
+

Answer: \(3\) per pile.

+

Steps: \(12 \div 4 = 3\) because \(4 \times 3 = 12\).

+
+
+ +
+ How many zeros are in one million written in digits? +
+

Answer: Six zeros: 1,000,000.

+
+
+ +

References

+
    +
  • Ifrah, Georges — The Universal History of Numbers (origins of counting and zero).
  • +
  • Crossley & Henry — early Indian arithmetic including zero.
  • +
+
diff --git a/content/math/counting-and-numbers/widgets/addition-groups.tsx b/content/math/counting-and-numbers/widgets/addition-groups.tsx new file mode 100644 index 0000000..a3f5f27 --- /dev/null +++ b/content/math/counting-and-numbers/widgets/addition-groups.tsx @@ -0,0 +1,91 @@ +import katex from "katex"; +import { createMemo, createSignal, For } from "solid-js"; + +function renderLatex(latex: string) { + return katex.renderToString(latex, { throwOnError: false, strict: "ignore" }); +} + +function DotPile(props: { count: number; label: string; class?: string }) { + return ( +
+ {props.label} + +
+ ); +} + +function AdditionGroups() { + const [a, setA] = createSignal(3); + const [b, setB] = createSignal(4); + const sum = createMemo(() => a() + b()); + + const equationHtml = createMemo(() => + renderLatex(`${a()} + ${b()} = ${sum()}`) + ); + + return ( +
+

+ Add two groups +

+
+
+
+ + setA(Number(e.currentTarget.value))} + /> +
+
+ + setB(Number(e.currentTarget.value))} + /> +
+
+ +
+ +
+ + + + + +
+
+
+ ); +} + +export default AdditionGroups; diff --git a/content/math/counting-and-numbers/widgets/big-numbers-scale.tsx b/content/math/counting-and-numbers/widgets/big-numbers-scale.tsx new file mode 100644 index 0000000..6d8cdd8 --- /dev/null +++ b/content/math/counting-and-numbers/widgets/big-numbers-scale.tsx @@ -0,0 +1,205 @@ +import { createMemo, createSignal, For, Show } from "solid-js"; + +type VisualKind = "one" | "ten" | "hundred" | "thousand" | "million" | "billion"; + +type ScaleStep = { + id: string; + label: string; + value: number; + display: string; + example: string; + visual: VisualKind; +}; + +const STEPS: ScaleStep[] = [ + { + id: "one", + label: "1", + value: 1, + display: "1", + example: "One apple on a plate.", + visual: "one", + }, + { + id: "ten", + label: "10", + value: 10, + display: "10", + example: "Fingers on two hands — easy to count one by one.", + visual: "ten", + }, + { + id: "hundred", + label: "100", + value: 100, + display: "100", + example: "A full stadium section; too many to count quickly without grouping.", + visual: "hundred", + }, + { + id: "thousand", + label: "1 thousand", + value: 1_000, + display: "1,000", + example: "A long walk in steps; a big school’s students.", + visual: "thousand", + }, + { + id: "million", + label: "1 million", + value: 1_000_000, + display: "1,000,000", + example: "A large city’s population — one dot per person would fill this whole grid.", + visual: "million", + }, + { + id: "billion", + label: "1 billion", + value: 1_000_000_000, + display: "1,000,000,000", + example: "About how many people live on Earth — one thousand times a whole city-million.", + visual: "billion", + }, +]; + +function DotGrid(props: { count: number; columns: number; small?: boolean }) { + const cells = () => Array.from({ length: props.count }); + return ( + + ); +} + +/** 10×10 = 100 cells; each stands for 10,000 → 1 million total */ +function MillionVisual() { + const cells = Array.from({ length: 100 }); + return ( + + ); +} + +/** Mini million (4×4 of 10k) beside ×1000 beside 10×10 grid of 1M blocks */ +function BillionVisual() { + const millionTiles = Array.from({ length: 16 }); + const billionTiles = Array.from({ length: 100 }); + return ( + + ); +} + +function BigNumbersScale() { + const [index, setIndex] = createSignal(2); + const step = createMemo(() => STEPS[index()]!); + const prev = createMemo(() => STEPS[Math.max(0, index() - 1)]); + const scaleRatio = createMemo(() => { + const p = prev().value; + const c = step().value; + if (p === c) return null; + return c / p; + }); + + return ( +
+

+ How big is the number? +

+
+
+ + {(s, i) => ( + + )} + +
+ +

+ {step().display} +

+ + 0}> +

+ About {scaleRatio()?.toLocaleString()} times bigger than {prev().display} +

+
+ +
+ + + + + + + + + + + + + + + + + +
+ +

{step().example}

+
+
+ ); +} + +export default BigNumbersScale; diff --git a/content/math/counting-and-numbers/widgets/counting-demo.tsx b/content/math/counting-and-numbers/widgets/counting-demo.tsx new file mode 100644 index 0000000..19f1449 --- /dev/null +++ b/content/math/counting-and-numbers/widgets/counting-demo.tsx @@ -0,0 +1,61 @@ +import { createSignal, For } from "solid-js"; + +const MAX = 10; + +function CountingDemo() { + const [count, setCount] = createSignal(0); + + const addOne = () => { + if (count() < MAX) setCount(count() + 1); + }; + + const reset = () => setCount(0); + + return ( +
+

+ Count the objects +

+
+

+ Tap to place one object at a time (up to {MAX}). Use reset to start again. +

+

+ Count: {count()} +

+
+ + {(_, i) => ( +
+
+ + +
+
+
+ ); +} + +export default CountingDemo; diff --git a/content/math/counting-and-numbers/widgets/division-sharing.tsx b/content/math/counting-and-numbers/widgets/division-sharing.tsx new file mode 100644 index 0000000..d61e344 --- /dev/null +++ b/content/math/counting-and-numbers/widgets/division-sharing.tsx @@ -0,0 +1,119 @@ +import { createMemo, createSignal, For, Show } from "solid-js"; + +function SharePile(props: { count: number; label: string }) { + return ( +
+ {props.label} + +
+ ); +} + +function DivisionSharing() { + const [total, setTotal] = createSignal(12); + const [groups, setGroups] = createSignal(3); + + const each = createMemo(() => Math.floor(total() / groups())); + const remainder = createMemo(() => total() % groups()); + const fair = createMemo(() => remainder() === 0); + + const groupLabels = createMemo(() => + Array.from({ length: groups() }, (_, i) => `Pile ${i + 1}`) + ); + + return ( +
+

+ Share the dots equally +

+
+
+
+ + setTotal(Number(e.currentTarget.value))} + /> +
+
+ + setGroups(Number(e.currentTarget.value))} + /> +
+
+ +

+ + {total()} ÷ {groups()} does not split evenly —{" "} + {each()} in each pile and {remainder()} left over + + } + > + {total()} ÷ {groups()} = {each()} dots + per pile + +

+ + +
+ + {(label) => } + +
+
+ + +
+
+ + {(label) => } + +
+
+ Left over + +
+
+
+ +

+ Check: {groups()} × {each()} = {groups() * each()} + — that matches {total()} dots. +

+
+
+ ); +} + +export default DivisionSharing; diff --git a/content/math/counting-and-numbers/widgets/multiplication-array.tsx b/content/math/counting-and-numbers/widgets/multiplication-array.tsx new file mode 100644 index 0000000..2d87b68 --- /dev/null +++ b/content/math/counting-and-numbers/widgets/multiplication-array.tsx @@ -0,0 +1,87 @@ +import katex from "katex"; +import { createMemo, createSignal, For } from "solid-js"; + +function renderLatex(latex: string) { + return katex.renderToString(latex, { throwOnError: false, strict: "ignore" }); +} + +function MultiplicationArray() { + const [rows, setRows] = createSignal(3); + const [cols, setCols] = createSignal(2); + const total = createMemo(() => rows() * cols()); + + const equationHtml = createMemo(() => + renderLatex(`${rows()} \\times ${cols()} = ${total()}`) + ); + + const cells = createMemo(() => Array.from({ length: total() })); + + return ( +
+

+ Multiplication array +

+
+
+
+ + setRows(Number(e.currentTarget.value))} + /> +
+
+ + setCols(Number(e.currentTarget.value))} + /> +
+
+ +
+ +
+ +
+ Each row has {cols()} dots. {rows()} rows give {total()} dots altogether. +
+
+
+
+ ); +} + +export default MultiplicationArray; diff --git a/content/math/directed-numbers-rates/_index.md b/content/math/directed-numbers-rates/_index.md index 1dedce3..d384028 100644 --- a/content/math/directed-numbers-rates/_index.md +++ b/content/math/directed-numbers-rates/_index.md @@ -2,7 +2,7 @@ title = "Directed numbers, rates & ratios" description = "Operate with negative numbers and solve ratio, rate, and proportion problems in context." template = "chapter.html" -weight = 0 +weight = 1 [extra] subject = "math" chapter_id = "directed-numbers-rates" @@ -11,9 +11,11 @@ strand = "Number & Algebra"

- Numbers on a line can lie to the right of zero (positive) or to the - left (negative). Temperatures below freezing, bank overdrafts, and positions - below sea level are everyday examples of directed numbers. + You already know how to count and work with whole numbers from 0 to + 10. On a number line, those values lie on or to the right of zero. + Numbers can also lie to the left of zero — we call them negative. + Temperatures below freezing, bank overdrafts, and positions below sea level are everyday examples + of directed numbers.

The number line

diff --git a/content/math/directed-numbers-rates/core.html b/content/math/directed-numbers-rates/core.html index a942c92..94da8b4 100644 --- a/content/math/directed-numbers-rates/core.html +++ b/content/math/directed-numbers-rates/core.html @@ -1,8 +1,10 @@

- Numbers on a line can lie to the right of zero (positive) or to the - left (negative). Temperatures below freezing, bank overdrafts, and positions - below sea level are everyday examples of directed numbers. + You already know how to count and work with whole numbers from 0 to + 10. On a number line, those values lie on or to the right of zero. + Numbers can also lie to the left of zero — we call them negative. + Temperatures below freezing, bank overdrafts, and positions below sea level are everyday examples + of directed numbers.

The number line

diff --git a/content/math/polynomials-expansion-factorisation/_index.md b/content/math/polynomials-expansion-factorisation/_index.md new file mode 100644 index 0000000..24097dd --- /dev/null +++ b/content/math/polynomials-expansion-factorisation/_index.md @@ -0,0 +1,374 @@ ++++ +title = "Polynomials: expansion & factorisation" +description = "Expand products, collect like terms, and factorise expressions using common factors and identities." +template = "chapter.html" +weight = 1 +[extra] +subject = "math" +chapter_id = "polynomials-expansion-factorisation" +strand = "Number & Algebra" ++++ + +
+

+ An algebraic expression combines numbers, variables, and operations. A + polynomial in one variable \(x\) is a sum of terms of the form + \(a x^n\) where \(a\) is a constant and \(n\) is a non-negative integer. Examples: + \(3x^2 - 5x + 1\), \(x^3 + 2x\), and \(7\). +

+ +

Terms, coefficients, and degree

+

+ In \(5x^2 - 3x + 4\), the terms are \(5x^2\), \(-3x\), and \(4\). The + coefficient of \(x^2\) is \(5\); the coefficient of \(x\) is \(-3\). The + degree of the polynomial is the highest power of \(x\) — here, \(2\). + Like terms have the same variable part (same power of \(x\)); only their + coefficients may differ. +

+ +

Adding and subtracting polynomials

+

+ Line up like terms and add or subtract their coefficients: + \[ (3x^2 + 2x - 1) + (x^2 - 5x + 4) = 4x^2 - 3x + 3. \] + When subtracting, distribute the minus sign to every term in the bracket: + \[ (2x^2 + x) - (x^2 - 3x + 2) = 2x^2 + x - x^2 + 3x - 2 = x^2 + 4x - 2. \] +

+ +

Expanding products

+

+ Use the distributive law: each term in the first bracket multiplies each term in + the second. For two binomials, + \[ (a+b)(c+d) = ac + ad + bc + bd. \] + Example: + \[ (x+3)(x-2) = x^2 - 2x + 3x - 6 = x^2 + x - 6. \] +

+

+ A binomial times a trinomial works the same way — multiply each of the two terms by each of the + three: + \[ (x+1)(x^2 - x + 2) = x^3 - x^2 + 2x + x^2 - x + 2 = x^3 + x + 2. \] +

+ +

Collecting like terms

+

+ After expanding, combine like terms so the answer is simplified. From above, + \(x^2 - 2x + 3x - 6\) becomes \(x^2 + x - 6\). Constants, \(x\)-terms, and \(x^2\)-terms are + collected separately. +

+ +

Factorising

+

+ Factorisation is the reverse of expansion: write an expression as a product of + simpler factors. Choose a method by inspecting the shape of the expression: +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
SituationMethod
Every term shares a common factorHighest common factor (HCF)
Four terms, pairs share factorsGrouping
Matches \(a^2-b^2\) or \((a\pm b)^2\)Standard identities
Quadratic in \(x\): \(ax^2+bx+c\)Two-number search or ac-method
+
+ +

Highest common factor

+

+ Factor out the largest factor common to every term: + \[ 6x^2 + 9x = 3x(2x + 3), \qquad 4x^3 - 8x^2 = 4x^2(x - 2). \] + Always check whether the bracket can be factorised further. +

+ +

Factorising by grouping

+

+ With four terms, split into two pairs and factor each pair: + \[ ax + ay + bx + by = a(x+y) + b(x+y) = (a+b)(x+y). \] + Example: + \[ 2x^2 + 6x - x - 3 = 2x(x+3) - 1(x+3) = (2x-1)(x+3). \] +

+ +

Standard identities

+
+

Identities

+

+ \[ a^2 - b^2 = (a+b)(a-b) \] + \[ (a+b)^2 = a^2 + 2ab + b^2 \] + \[ (a-b)^2 = a^2 - 2ab + b^2 \] +

+
+

+ Recognising these forms speeds up factorisation. For example, + \(x^2 - 9 = x^2 - 3^2 = (x+3)(x-3)\) and + \(x^2 + 6x + 9 = (x+3)^2\). +

+ +

Quadratic trinomials

+

+ To factorise a monic quadratic \(x^2 + bx + c\), find two numbers that + multiply to \(c\) and add to \(b\): + \[ x^2 + 5x + 6 = (x+2)(x+3) \quad\text{since } 2\times 3 = 6,\; 2+3 = 5. \] +

+

+ For a non-monic quadratic \(ax^2 + bx + c\) with \(a \neq 1\), use the + ac-method: find two numbers that multiply to \(ac\) and add to \(b\), split the + middle term, then factor by grouping: + \[ 2x^2 + 7x + 3 = 2x^2 + 6x + x + 3 = 2x(x+3) + 1(x+3) = (2x+1)(x+3). \] +

+

+ This chapter stops at factorising expressions. Solving equations of the form \(ax^2+bx+c=0\) is + covered in the chapter on quadratic equations. +

+ +

Try it yourself

+

+ Use the area model to see how \((a+b)(c+d)\) splits into four partial products. Then practise + choosing a factorisation method and checking your factors in the explorer below. +

+
+ +
+ +
+ +
+

History

+

+ Long before modern symbols, people solved problems that required multiplying lengths and + collecting areas — the same ideas behind expanding and factorising. Babylonian scribes (around + 1800 BCE) recorded rectangle problems on clay tablets: given area and side relationships, + find unknown lengths. Their recipes are early cousins of “expand, then simplify.” +

+ +
+ Illustrated timeline: Babylonian area on clay tablets, al-Khwarizmi's algebra, Viète's difference of squares, Enlightenment science, and modern expand–factorise steps +
+ From geometric area puzzles to symbolic algebra: how expansion and factorisation became + standard tools in school mathematics. +
+
+ +

+ In the 9th century, al-Khwarizmi organised methods for equations and products + in Arabic texts that later spread to Europe. Renaissance mathematicians such as + Viète introduced letters for unknowns and constants, making it easier to see + patterns like \(a^2 - b^2\). By the 17th–18th centuries, polynomial algebra was central to + calculus and science; factorisation became a routine step before solving equations or + simplifying formulas. +

+ +

Derivation

+ +

Area proof of \((a+b)(c+d)\)

+

+ Draw a rectangle with width \(a+b\) and height \(c+d\). The total area is \((a+b)(c+d)\). Split + the rectangle into four smaller rectangles with areas \(ac\), \(ad\), \(bc\), and \(bd\). The + sum of partial areas equals the whole: + \[ (a+b)(c+d) = ac + ad + bc + bd. \] + This is the distributive law in two dimensions — the same picture as in the area-model widget + above. +

+ +

Deriving standard identities

+

+ Set \(c = a\) and \(d = b\) in the area formula for a square of side \(a+b\): + \[ (a+b)^2 = a^2 + ab + ab + b^2 = a^2 + 2ab + b^2. \] + For a square of side \(a-b\) (with \(a > b\)), remove a strip of width \(b\) from a square of + side \(a\); the remaining L-shape rearranges to show + \[ (a-b)^2 = a^2 - 2ab + b^2. \] + Difference of squares: a large square of side \(a\) minus a small square of side \(b\) leaves two + congruent rectangles, which rearrange to a rectangle of dimensions \((a+b)\) by \((a-b)\): + \[ a^2 - b^2 = (a+b)(a-b). \] +

+ +

Grouping walkthrough

+

+ Factorise \(3x^2 + 12x - 2x - 8\). +

+
    +
  1. Group: \((3x^2 + 12x) + (-2x - 8)\).
  2. +
  3. Factor each pair: \(3x(x+4) - 2(x+4)\).
  4. +
  5. Common bracket \((x+4)\): \((3x-2)(x+4)\).
  6. +
+ +

Checkpoints

+

+ Pause and reason before continuing. Discuss with a partner or write your work in a notebook. +

+ +
+

Checkpoint

+

+ In \(4x^3 - 2x^2 + 5\), what is the degree? Which terms are like terms with \(4x^3\)? +

+
+ +
+

Checkpoint

+

+ Expand \((2x-1)(x+4)\) without skipping steps. How many terms do you get before collecting? +

+
+ +
+

Checkpoint

+

+ How would you factorise \(x^2 - 16\)? Which identity applies? +

+
+ +
+

Checkpoint

+

+ Expand \(x(x+1) - (x+1)\). What common factor appears? What is the factorised form? +

+
+ +

Applications

+ +

Geometry: area and perimeter

+

+ A rectangle has sides \((x+3)\) cm and \((2x-1)\) cm. Its area is + \[ (x+3)(2x-1) = 2x^2 + 5x - 3 \quad\text{cm}^2. \] + The perimeter is \(2\bigl((x+3)+(2x-1)\bigr) = 2(3x+2) = 6x+4\) cm. Expansion links algebraic + descriptions of sides to measurable quantities. +

+ +

Revenue and pricing

+

+ If a shop sells \(n\) items at price \((50 - 0.5n)\) dollars each, revenue is + \(n(50 - 0.5n) = 50n - 0.5n^2\). Expanding a product of two linear factors often appears before + finding maximum revenue (a quadratic in \(n\)). +

+ +

Number patterns

+

+ Notice that \(11^2 = 121\), \(111^2 = 12321\). In general, expanding \((10^k + 10^{k-1} + + \cdots + 1)^2\) explains palindromic squares — a playful link between identities and arithmetic + patterns. +

+ +

Question bank

+

+ Work each question, then open the solution to check your reasoning. Difficulty increases + through the sets. +

+ +

Easy

+ +
+ Expand \(3(x+2)\). +
+

Answer: \(3x + 6\).

+

Steps: \(3 \cdot x + 3 \cdot 2 = 3x + 6\).

+
+
+ +
+ Simplify \(2x + 5x - 1\). +
+

Answer: \(7x - 1\).

+

Explanation: Combine like terms \(2x + 5x = 7x\).

+
+
+ +
+ Factorise \(6x + 9\). +
+

Answer: \(3(2x + 3)\).

+

Steps: HCF is \(3\); \(6x \div 3 = 2x\), \(9 \div 3 = 3\).

+
+
+ +

Intermediate

+ +
+ Expand \((x+4)(x-2)\). +
+

Answer: \(x^2 + 2x - 8\).

+

Steps: \(x^2 - 2x + 4x - 8 = x^2 + 2x - 8\).

+
+
+ +
+ Factorise \(x^2 - 9\). +
+

Answer: \((x+3)(x-3)\).

+

Explanation: Difference of squares: \(x^2 - 3^2\).

+
+
+ +
+ Factorise \(x^2 + 6x + 9\). +
+

Answer: \((x+3)^2\).

+

Explanation: Perfect square: \(3 \times 3 = 9\), \(3 + 3 = 6\).

+
+
+ +

Difficult

+ +
+ Factorise \(2x^2 + 6x - x - 3\) by grouping. +
+

Answer: \((2x-1)(x+3)\).

+

Steps: \(2x(x+3) - 1(x+3) = (2x-1)(x+3)\).

+
+
+ +
+ Factorise \(2x^2 + 7x + 3\). +
+

Answer: \((2x+1)(x+3)\).

+

Steps: \(ac = 6\); split \(7x = 6x + x\); \(2x(x+3) + 1(x+3) = (2x+1)(x+3)\).

+
+
+ +

Hardcore

+ +
+ Expand and then factorise \(x(x+2) - (x+2)\). +
+

Answer: \((x+2)(x-1)\) after factorising (expansion gives \(x^2 + x - 2\)).

+

Steps: Factor common \((x+2)\): \((x+2)(x-1)\). Check: \((x+2)(x-1) = x^2 + x - 2\).

+
+
+ +
+ A rectangle has sides \((x+3)\) cm and \((2x-1)\) cm. Find its area in expanded form. +
+

Answer: \((2x^2 + 5x - 3)\) cm².

+

Calculation: \((x+3)(2x-1) = 2x^2 - x + 6x - 3 = 2x^2 + 5x - 3\).

+
+
+ +

References

+
    +
  • al-Khwarizmi, Al-Kitāb al-mukhtaṣar fī ḥisāb al-jabr wal-muqābala (c. 820 CE) — systematic treatment of algebra.
  • +
  • HKDSE Compulsory Part curriculum — Number and Algebra strand (polynomials, expansion, factorisation).
  • +
+
diff --git a/content/math/polynomials-expansion-factorisation/assets/polynomials-history.png b/content/math/polynomials-expansion-factorisation/assets/polynomials-history.png new file mode 100644 index 0000000..50a0140 Binary files /dev/null and b/content/math/polynomials-expansion-factorisation/assets/polynomials-history.png differ diff --git a/content/math/polynomials-expansion-factorisation/chapter.scss b/content/math/polynomials-expansion-factorisation/chapter.scss new file mode 100644 index 0000000..5c0bf4a --- /dev/null +++ b/content/math/polynomials-expansion-factorisation/chapter.scss @@ -0,0 +1,72 @@ +.polynomials-area-model__grid { + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 1fr 1fr; + gap: 4px; + max-width: 320px; + margin: 0 auto; + aspect-ratio: 1; +} + +.polynomials-area-model__cell { + display: flex; + align-items: center; + justify-content: center; + min-height: 72px; + border-radius: 6px; + font-family: var(--mono); + font-size: 0.85rem; + font-weight: 600; +} + +.polynomials-area-model__cell--ac { + background: rgba(37, 99, 235, 0.15); +} + +.polynomials-area-model__cell--ad { + background: rgba(74, 107, 74, 0.2); +} + +.polynomials-area-model__cell--bc { + background: rgba(154, 107, 46, 0.2); +} + +.polynomials-area-model__cell--bd { + background: rgba(220, 38, 38, 0.12); +} + +.polynomials-factor-checker__feedback { + margin-top: 12px; + padding: 12px 14px; + border-radius: 8px; + border: 1px solid var(--line); + font-size: 0.9rem; +} + +.polynomials-factor-checker__feedback--correct { + border-color: #16a34a; + background: rgba(22, 163, 74, 0.08); +} + +.polynomials-factor-checker__feedback--incorrect { + border-color: #dc2626; + background: rgba(220, 38, 38, 0.06); +} + +.polynomials-factor-checker__steps { + margin: 8px 0 0; + padding-left: 1.2rem; + color: var(--soft-ink); +} + +.polynomials-factor-checker__input { + width: 100%; + max-width: 420px; + padding: 8px 12px; + font-family: var(--mono); + font-size: 0.9rem; + border: 1px solid var(--line); + border-radius: 8px; + background: var(--card-bg); + color: var(--ink); +} diff --git a/content/math/polynomials-expansion-factorisation/core.html b/content/math/polynomials-expansion-factorisation/core.html new file mode 100644 index 0000000..375ba56 --- /dev/null +++ b/content/math/polynomials-expansion-factorisation/core.html @@ -0,0 +1,137 @@ +
+

+ An algebraic expression combines numbers, variables, and operations. A + polynomial in one variable \(x\) is a sum of terms of the form + \(a x^n\) where \(a\) is a constant and \(n\) is a non-negative integer. Examples: + \(3x^2 - 5x + 1\), \(x^3 + 2x\), and \(7\). +

+ +

Terms, coefficients, and degree

+

+ In \(5x^2 - 3x + 4\), the terms are \(5x^2\), \(-3x\), and \(4\). The + coefficient of \(x^2\) is \(5\); the coefficient of \(x\) is \(-3\). The + degree of the polynomial is the highest power of \(x\) — here, \(2\). + Like terms have the same variable part (same power of \(x\)); only their + coefficients may differ. +

+ +

Adding and subtracting polynomials

+

+ Line up like terms and add or subtract their coefficients: + \[ (3x^2 + 2x - 1) + (x^2 - 5x + 4) = 4x^2 - 3x + 3. \] + When subtracting, distribute the minus sign to every term in the bracket: + \[ (2x^2 + x) - (x^2 - 3x + 2) = 2x^2 + x - x^2 + 3x - 2 = x^2 + 4x - 2. \] +

+ +

Expanding products

+

+ Use the distributive law: each term in the first bracket multiplies each term in + the second. For two binomials, + \[ (a+b)(c+d) = ac + ad + bc + bd. \] + Example: + \[ (x+3)(x-2) = x^2 - 2x + 3x - 6 = x^2 + x - 6. \] +

+

+ A binomial times a trinomial works the same way — multiply each of the two terms by each of the + three: + \[ (x+1)(x^2 - x + 2) = x^3 - x^2 + 2x + x^2 - x + 2 = x^3 + x + 2. \] +

+ +

Collecting like terms

+

+ After expanding, combine like terms so the answer is simplified. From above, + \(x^2 - 2x + 3x - 6\) becomes \(x^2 + x - 6\). Constants, \(x\)-terms, and \(x^2\)-terms are + collected separately. +

+ +

Factorising

+

+ Factorisation is the reverse of expansion: write an expression as a product of + simpler factors. Choose a method by inspecting the shape of the expression: +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
SituationMethod
Every term shares a common factorHighest common factor (HCF)
Four terms, pairs share factorsGrouping
Matches \(a^2-b^2\) or \((a\pm b)^2\)Standard identities
Quadratic in \(x\): \(ax^2+bx+c\)Two-number search or ac-method
+
+ +

Highest common factor

+

+ Factor out the largest factor common to every term: + \[ 6x^2 + 9x = 3x(2x + 3), \qquad 4x^3 - 8x^2 = 4x^2(x - 2). \] + Always check whether the bracket can be factorised further. +

+ +

Factorising by grouping

+

+ With four terms, split into two pairs and factor each pair: + \[ ax + ay + bx + by = a(x+y) + b(x+y) = (a+b)(x+y). \] + Example: + \[ 2x^2 + 6x - x - 3 = 2x(x+3) - 1(x+3) = (2x-1)(x+3). \] +

+ +

Standard identities

+
+

Identities

+

+ \[ a^2 - b^2 = (a+b)(a-b) \] + \[ (a+b)^2 = a^2 + 2ab + b^2 \] + \[ (a-b)^2 = a^2 - 2ab + b^2 \] +

+
+

+ Recognising these forms speeds up factorisation. For example, + \(x^2 - 9 = x^2 - 3^2 = (x+3)(x-3)\) and + \(x^2 + 6x + 9 = (x+3)^2\). +

+ +

Quadratic trinomials

+

+ To factorise a monic quadratic \(x^2 + bx + c\), find two numbers that + multiply to \(c\) and add to \(b\): + \[ x^2 + 5x + 6 = (x+2)(x+3) \quad\text{since } 2\times 3 = 6,\; 2+3 = 5. \] +

+

+ For a non-monic quadratic \(ax^2 + bx + c\) with \(a \neq 1\), use the + ac-method: find two numbers that multiply to \(ac\) and add to \(b\), split the + middle term, then factor by grouping: + \[ 2x^2 + 7x + 3 = 2x^2 + 6x + x + 3 = 2x(x+3) + 1(x+3) = (2x+1)(x+3). \] +

+

+ This chapter stops at factorising expressions. Solving equations of the form \(ax^2+bx+c=0\) is + covered in the chapter on quadratic equations. +

+ +

Try it yourself

+

+ Use the area model to see how \((a+b)(c+d)\) splits into four partial products. Then practise + choosing a factorisation method and checking your factors in the explorer below. +

+
+ +
+ +
diff --git a/content/math/polynomials-expansion-factorisation/supplement.html b/content/math/polynomials-expansion-factorisation/supplement.html new file mode 100644 index 0000000..da61975 --- /dev/null +++ b/content/math/polynomials-expansion-factorisation/supplement.html @@ -0,0 +1,225 @@ +
+

History

+

+ Long before modern symbols, people solved problems that required multiplying lengths and + collecting areas — the same ideas behind expanding and factorising. Babylonian scribes (around + 1800 BCE) recorded rectangle problems on clay tablets: given area and side relationships, + find unknown lengths. Their recipes are early cousins of “expand, then simplify.” +

+ +
+ Illustrated timeline: Babylonian area on clay tablets, al-Khwarizmi's algebra, Viète's difference of squares, Enlightenment science, and modern expand–factorise steps +
+ From geometric area puzzles to symbolic algebra: how expansion and factorisation became + standard tools in school mathematics. +
+
+ +

+ In the 9th century, al-Khwarizmi organised methods for equations and products + in Arabic texts that later spread to Europe. Renaissance mathematicians such as + Viète introduced letters for unknowns and constants, making it easier to see + patterns like \(a^2 - b^2\). By the 17th–18th centuries, polynomial algebra was central to + calculus and science; factorisation became a routine step before solving equations or + simplifying formulas. +

+ +

Derivation

+ +

Area proof of \((a+b)(c+d)\)

+

+ Draw a rectangle with width \(a+b\) and height \(c+d\). The total area is \((a+b)(c+d)\). Split + the rectangle into four smaller rectangles with areas \(ac\), \(ad\), \(bc\), and \(bd\). The + sum of partial areas equals the whole: + \[ (a+b)(c+d) = ac + ad + bc + bd. \] + This is the distributive law in two dimensions — the same picture as in the area-model widget + above. +

+ +

Deriving standard identities

+

+ Set \(c = a\) and \(d = b\) in the area formula for a square of side \(a+b\): + \[ (a+b)^2 = a^2 + ab + ab + b^2 = a^2 + 2ab + b^2. \] + For a square of side \(a-b\) (with \(a > b\)), remove a strip of width \(b\) from a square of + side \(a\); the remaining L-shape rearranges to show + \[ (a-b)^2 = a^2 - 2ab + b^2. \] + Difference of squares: a large square of side \(a\) minus a small square of side \(b\) leaves two + congruent rectangles, which rearrange to a rectangle of dimensions \((a+b)\) by \((a-b)\): + \[ a^2 - b^2 = (a+b)(a-b). \] +

+ +

Grouping walkthrough

+

+ Factorise \(3x^2 + 12x - 2x - 8\). +

+
    +
  1. Group: \((3x^2 + 12x) + (-2x - 8)\).
  2. +
  3. Factor each pair: \(3x(x+4) - 2(x+4)\).
  4. +
  5. Common bracket \((x+4)\): \((3x-2)(x+4)\).
  6. +
+ +

Checkpoints

+

+ Pause and reason before continuing. Discuss with a partner or write your work in a notebook. +

+ +
+

Checkpoint

+

+ In \(4x^3 - 2x^2 + 5\), what is the degree? Which terms are like terms with \(4x^3\)? +

+
+ +
+

Checkpoint

+

+ Expand \((2x-1)(x+4)\) without skipping steps. How many terms do you get before collecting? +

+
+ +
+

Checkpoint

+

+ How would you factorise \(x^2 - 16\)? Which identity applies? +

+
+ +
+

Checkpoint

+

+ Expand \(x(x+1) - (x+1)\). What common factor appears? What is the factorised form? +

+
+ +

Applications

+ +

Geometry: area and perimeter

+

+ A rectangle has sides \((x+3)\) cm and \((2x-1)\) cm. Its area is + \[ (x+3)(2x-1) = 2x^2 + 5x - 3 \quad\text{cm}^2. \] + The perimeter is \(2\bigl((x+3)+(2x-1)\bigr) = 2(3x+2) = 6x+4\) cm. Expansion links algebraic + descriptions of sides to measurable quantities. +

+ +

Revenue and pricing

+

+ If a shop sells \(n\) items at price \((50 - 0.5n)\) dollars each, revenue is + \(n(50 - 0.5n) = 50n - 0.5n^2\). Expanding a product of two linear factors often appears before + finding maximum revenue (a quadratic in \(n\)). +

+ +

Number patterns

+

+ Notice that \(11^2 = 121\), \(111^2 = 12321\). In general, expanding \((10^k + 10^{k-1} + + \cdots + 1)^2\) explains palindromic squares — a playful link between identities and arithmetic + patterns. +

+ +

Question bank

+

+ Work each question, then open the solution to check your reasoning. Difficulty increases + through the sets. +

+ +

Easy

+ +
+ Expand \(3(x+2)\). +
+

Answer: \(3x + 6\).

+

Steps: \(3 \cdot x + 3 \cdot 2 = 3x + 6\).

+
+
+ +
+ Simplify \(2x + 5x - 1\). +
+

Answer: \(7x - 1\).

+

Explanation: Combine like terms \(2x + 5x = 7x\).

+
+
+ +
+ Factorise \(6x + 9\). +
+

Answer: \(3(2x + 3)\).

+

Steps: HCF is \(3\); \(6x \div 3 = 2x\), \(9 \div 3 = 3\).

+
+
+ +

Intermediate

+ +
+ Expand \((x+4)(x-2)\). +
+

Answer: \(x^2 + 2x - 8\).

+

Steps: \(x^2 - 2x + 4x - 8 = x^2 + 2x - 8\).

+
+
+ +
+ Factorise \(x^2 - 9\). +
+

Answer: \((x+3)(x-3)\).

+

Explanation: Difference of squares: \(x^2 - 3^2\).

+
+
+ +
+ Factorise \(x^2 + 6x + 9\). +
+

Answer: \((x+3)^2\).

+

Explanation: Perfect square: \(3 \times 3 = 9\), \(3 + 3 = 6\).

+
+
+ +

Difficult

+ +
+ Factorise \(2x^2 + 6x - x - 3\) by grouping. +
+

Answer: \((2x-1)(x+3)\).

+

Steps: \(2x(x+3) - 1(x+3) = (2x-1)(x+3)\).

+
+
+ +
+ Factorise \(2x^2 + 7x + 3\). +
+

Answer: \((2x+1)(x+3)\).

+

Steps: \(ac = 6\); split \(7x = 6x + x\); \(2x(x+3) + 1(x+3) = (2x+1)(x+3)\).

+
+
+ +

Hardcore

+ +
+ Expand and then factorise \(x(x+2) - (x+2)\). +
+

Answer: \((x+2)(x-1)\) after factorising (expansion gives \(x^2 + x - 2\)).

+

Steps: Factor common \((x+2)\): \((x+2)(x-1)\). Check: \((x+2)(x-1) = x^2 + x - 2\).

+
+
+ +
+ A rectangle has sides \((x+3)\) cm and \((2x-1)\) cm. Find its area in expanded form. +
+

Answer: \((2x^2 + 5x - 3)\) cm².

+

Calculation: \((x+3)(2x-1) = 2x^2 - x + 6x - 3 = 2x^2 + 5x - 3\).

+
+
+ +

References

+
    +
  • al-Khwarizmi, Al-Kitāb al-mukhtaṣar fī ḥisāb al-jabr wal-muqābala (c. 820 CE) — systematic treatment of algebra.
  • +
  • HKDSE Compulsory Part curriculum — Number and Algebra strand (polynomials, expansion, factorisation).
  • +
+
diff --git a/content/math/polynomials-expansion-factorisation/widgets/area-model.tsx b/content/math/polynomials-expansion-factorisation/widgets/area-model.tsx new file mode 100644 index 0000000..70d04b6 --- /dev/null +++ b/content/math/polynomials-expansion-factorisation/widgets/area-model.tsx @@ -0,0 +1,152 @@ +import katex from "katex"; +import { createEffect, createMemo, createSignal } from "solid-js"; +import { renderMathInContainer } from "../../../../frontend/src/lib/render-math"; + +function formatNum(n: number) { + return String(n); +} + +function renderLatex(latex: string) { + return katex.renderToString(latex, { throwOnError: false, strict: "ignore" }); +} + +function AreaModel() { + const [a, setA] = createSignal(2); + const [b, setB] = createSignal(3); + const [c, setC] = createSignal(1); + const [d, setD] = createSignal(4); + + const ac = createMemo(() => a() * c()); + const ad = createMemo(() => a() * d()); + const bc = createMemo(() => b() * c()); + const bd = createMemo(() => b() * d()); + const total = createMemo(() => ac() + ad() + bc() + bd()); + + const expansionHtml = createMemo(() => + renderLatex( + `(${formatNum(a())}+${formatNum(b())})(${formatNum(c())}+${formatNum(d())}) = ${ac()} + ${ad()} + ${bc()} + ${bd()} = ${total()}` + ) + ); + + let captionRef: HTMLElement | undefined; + + createEffect(() => { + a(); + b(); + c(); + d(); + expansionHtml(); + if (captionRef) renderMathInContainer(captionRef); + }); + + return ( +
+

Area model for expansion

+
+
+
+ + setA(Number(e.currentTarget.value))} + /> +
+
+ + setB(Number(e.currentTarget.value))} + /> +
+
+ + setC(Number(e.currentTarget.value))} + /> +
+
+ + setD(Number(e.currentTarget.value))} + /> +
+
+ +
+ +
+ +
{ + captionRef = el; + if (el) renderMathInContainer(el); + }} + > + A rectangle of side \((a+b)\) by \((c+d)\) splits into regions \(ac\), \(ad\), \(bc\), + \(bd\). +
+
+
+
+ ); +} + +export default AreaModel; diff --git a/content/math/polynomials-expansion-factorisation/widgets/factorisation-checker.tsx b/content/math/polynomials-expansion-factorisation/widgets/factorisation-checker.tsx new file mode 100644 index 0000000..f8ca513 --- /dev/null +++ b/content/math/polynomials-expansion-factorisation/widgets/factorisation-checker.tsx @@ -0,0 +1,267 @@ +import { createMemo, createSignal, For, Show } from "solid-js"; + +type Technique = + | "hcf" + | "grouping" + | "difference-squares" + | "perfect-square" + | "quadratic"; + +type Problem = { + id: string; + expression: string; + answers: string[]; + steps: string[]; +}; + +const PROBLEMS: Record = { + hcf: [ + { + id: "hcf-1", + expression: "6x + 9", + answers: ["3(2x+3)", "3(2x + 3)"], + steps: [ + "HCF of 6 and 9 is 3.", + "Factor out 3: 3(2x + 3).", + ], + }, + { + id: "hcf-2", + expression: "4x² − 8x", + answers: ["4x(x-2)", "4x(x − 2)", "4x(x-2)"], + steps: [ + "HCF is 4x.", + "4x² ÷ 4x = x; −8x ÷ 4x = −2.", + "Result: 4x(x − 2).", + ], + }, + ], + grouping: [ + { + id: "grp-1", + expression: "ax + ay + bx + by", + answers: ["(a+b)(x+y)", "(a+b)(x + y)", "(b+a)(x+y)"], + steps: [ + "Group: a(x+y) + b(x+y).", + "Common bracket (x+y): (a+b)(x+y).", + ], + }, + { + id: "grp-2", + expression: "2x² + 6x − x − 3", + answers: ["(2x-1)(x+3)", "(2x-1)(x + 3)", "(x+3)(2x-1)"], + steps: [ + "Group: 2x(x+3) − 1(x+3).", + "Factor (x+3): (2x−1)(x+3).", + ], + }, + ], + "difference-squares": [ + { + id: "dos-1", + expression: "x² − 9", + answers: ["(x+3)(x-3)", "(x-3)(x+3)", "(x + 3)(x - 3)"], + steps: [ + "Recognise a² − b² with a = x, b = 3.", + "(x+3)(x−3).", + ], + }, + { + id: "dos-2", + expression: "4x² − 25", + answers: ["(2x+5)(2x-5)", "(2x-5)(2x+5)", "(2x + 5)(2x - 5)"], + steps: [ + "4x² = (2x)² and 25 = 5².", + "(2x+5)(2x−5).", + ], + }, + ], + "perfect-square": [ + { + id: "ps-1", + expression: "x² + 6x + 9", + answers: ["(x+3)²", "(x+3)^2", "(x + 3)^2"], + steps: [ + "Check: 3 × 3 = 9 and 3 + 3 = 6.", + "Perfect square: (x+3)².", + ], + }, + { + id: "ps-2", + expression: "x² − 10x + 25", + answers: ["(x-5)²", "(x-5)^2", "(x − 5)^2"], + steps: [ + "5 × 5 = 25 and −5 + (−5) = −10.", + "(x−5)².", + ], + }, + ], + quadratic: [ + { + id: "quad-1", + expression: "x² + 5x + 6", + answers: ["(x+2)(x+3)", "(x+3)(x+2)", "(x + 2)(x + 3)"], + steps: [ + "Find two numbers: product 6, sum 5 → 2 and 3.", + "(x+2)(x+3).", + ], + }, + { + id: "quad-2", + expression: "2x² + 7x + 3", + answers: ["(2x+1)(x+3)", "(x+3)(2x+1)", "(2x + 1)(x + 3)"], + steps: [ + "ac = 6; split 7x as 6x + x.", + "2x(x+3) + 1(x+3) = (2x+1)(x+3).", + ], + }, + ], +}; + +const TECHNIQUE_LABELS: Record = { + hcf: "Highest common factor", + grouping: "Grouping", + "difference-squares": "Difference of squares", + "perfect-square": "Perfect square", + quadratic: "Quadratic trinomial", +}; + +/** Normalize student input for comparison: lowercase, no spaces, ×→*, superscript ²→^2 */ +function normalizeAnswer(raw: string): string { + return raw + .toLowerCase() + .replace(/\s+/g, "") + .replace(/×/g, "*") + .replace(/²/g, "^2") + .replace(/−/g, "-") + .replace(/–/g, "-"); +} + +function FactorisationChecker() { + const [technique, setTechnique] = createSignal("hcf"); + const [problemIndex, setProblemIndex] = createSignal(0); + const [input, setInput] = createSignal(""); + const [checked, setChecked] = createSignal(false); + const [revealed, setRevealed] = createSignal(false); + + const problems = createMemo(() => PROBLEMS[technique()]); + const problem = createMemo(() => problems()[problemIndex() % problems().length]); + + const isCorrect = createMemo(() => { + if (!checked()) return false; + const norm = normalizeAnswer(input()); + return problem().answers.some((a) => normalizeAnswer(a) === norm); + }); + + const changeTechnique = (t: Technique) => { + setTechnique(t); + setProblemIndex(0); + setInput(""); + setChecked(false); + setRevealed(false); + }; + + const nextProblem = () => { + setProblemIndex((i) => (i + 1) % problems().length); + setInput(""); + setChecked(false); + setRevealed(false); + }; + + const checkAnswer = () => { + setChecked(true); + }; + + return ( +
+

Factorisation checker

+
+
+ + +
+ +

+ Factorise: {problem().expression} +

+ +
+ + { + setInput(e.currentTarget.value); + setChecked(false); + setRevealed(false); + }} + /> +
+ +
+ + + +
+ + + + + + + + +
+
+ ); +} + +export default FactorisationChecker; diff --git a/content/math/quadratic-equations/_index.md b/content/math/quadratic-equations/_index.md index 85ae197..317b89c 100644 --- a/content/math/quadratic-equations/_index.md +++ b/content/math/quadratic-equations/_index.md @@ -2,7 +2,7 @@ title = "Quadratic equations" description = "The discriminant, nature of roots, and the graph of y = ax² + bx + c." template = "chapter.html" -weight = 1 +weight = 2 [extra] subject = "math" chapter_id = "quadratic-equations" diff --git a/data/catalog.json b/data/catalog.json index 82f68cf..40653e6 100644 --- a/data/catalog.json +++ b/data/catalog.json @@ -1,7 +1,7 @@ { "title": "Curriculum Catalog", "subtitle": "Browse chapters by subject and curriculum", - "curriculums": ["DSE", "IB", "A-Level", "AP", "IGCSE"], + "curriculums": ["Foundation", "DSE", "IB", "A-Level", "AP", "IGCSE"], "subjects": [ { "id": "math", "name": "Mathematics" }, { "id": "science", "name": "Science" }, diff --git a/data/math-curriculum.json b/data/math-curriculum.json index 36c5fa9..5d6cd54 100644 --- a/data/math-curriculum.json +++ b/data/math-curriculum.json @@ -4,6 +4,7 @@ "intro": "Topic units across three strands. The map shows required prerequisites; the list follows a readable teaching order.", "graph": { "edges": [ + { "from": "counting-and-numbers", "to": "directed-numbers-rates" }, { "from": "directed-numbers-rates", "to": "polynomials-expansion-factorisation" }, { "from": "polynomials-expansion-factorisation", "to": "algebraic-fractions-formulas" }, { "from": "polynomials-expansion-factorisation", "to": "linear-equations-two-unknowns" }, @@ -49,6 +50,13 @@ "id": "number-algebra", "title": "Number & Algebra", "chapters": [ + { + "slug": "counting-and-numbers", + "title": "Counting and numbers", + "description": "Count from zero, spot patterns, add, multiply, and divide; then meet place value and big numbers from hundreds to billions.", + "status": "live", + "curriculums": ["Foundation"] + }, { "slug": "directed-numbers-rates", "title": "Directed numbers, rates & ratios", @@ -60,14 +68,14 @@ "slug": "polynomials-expansion-factorisation", "title": "Polynomials: expansion & factorisation", "description": "Expand products, collect like terms, and factorise expressions using common factors and identities.", - "status": "planned", + "status": "live", "curriculums": ["DSE"] }, { "slug": "algebraic-fractions-formulas", "title": "Algebraic fractions & formulas", "description": "Simplify algebraic fractions and change the subject of formulas in applied contexts.", - "status": "planned", + "status": "live", "curriculums": ["DSE"] }, { diff --git a/frontend/src/components/chapter-heading-nav.tsx b/frontend/src/components/chapter-heading-nav.tsx index 8e9d505..0173816 100644 --- a/frontend/src/components/chapter-heading-nav.tsx +++ b/frontend/src/components/chapter-heading-nav.tsx @@ -6,6 +6,8 @@ type NavHeading = { level: 2 | 3; }; +/** Delay before closing the rail menu so brief pointer gaps do not dismiss it. */ +const RAIL_CLOSE_DELAY_MS = 200; /** Align with sticky site header (see .book-prose__heading scroll-margin-top). */ const SCROLL_OFFSET = 96; const CLICK_LOCK_FALLBACK_MS = 900; @@ -44,14 +46,57 @@ function pickActiveId(items: NavHeading[]): string | null { return active; } +function scrollMenuToActive(container: HTMLElement | undefined, activeId: string | null) { + if (!container || !activeId) return; + const activeEl = container.querySelector(`[data-heading-id="${CSS.escape(activeId)}"]`); + if (activeEl instanceof HTMLElement) { + activeEl.scrollIntoView({ block: "center" }); + } +} + export function ChapterHeadingNav() { const [headings, setHeadings] = createSignal([]); const [activeId, setActiveId] = createSignal(null); const [railOpen, setRailOpen] = createSignal(false); const [sheetOpen, setSheetOpen] = createSignal(false); const [isMobile, setIsMobile] = createSignal(false); + const [popoverListEl, setPopoverListEl] = createSignal(); + const [sheetEl, setSheetEl] = createSignal(); let scrollToHeading: ((id: string) => void) | undefined; + let railCloseTimer: number | undefined; + + const syncActiveFromScroll = () => { + const items = headings(); + if (items.length > 0) { + setActiveId(pickActiveId(items)); + } + }; + + const openRail = () => { + if (railCloseTimer !== undefined) { + window.clearTimeout(railCloseTimer); + railCloseTimer = undefined; + } + syncActiveFromScroll(); + setRailOpen(true); + }; + + const scheduleRailClose = () => { + if (railCloseTimer !== undefined) { + window.clearTimeout(railCloseTimer); + } + railCloseTimer = window.setTimeout(() => { + railCloseTimer = undefined; + setRailOpen(false); + }, RAIL_CLOSE_DELAY_MS); + }; + + onCleanup(() => { + if (railCloseTimer !== undefined) { + window.clearTimeout(railCloseTimer); + } + }); onMount(() => { const article = document.querySelector(".book-chapter"); @@ -146,6 +191,35 @@ export function ChapterHeadingNav() { } }); + createEffect(() => { + if (!railOpen()) return; + const list = popoverListEl(); + const id = activeId(); + if (!list || !id) return; + requestAnimationFrame(() => scrollMenuToActive(list, id)); + }); + + createEffect(() => { + if (!sheetOpen()) return; + const sheet = sheetEl(); + const id = activeId(); + if (!sheet || !id) return; + requestAnimationFrame(() => scrollMenuToActive(sheet, id)); + }); + + const openSheet = () => { + syncActiveFromScroll(); + setSheetOpen(true); + }; + + const toggleSheet = () => { + if (sheetOpen()) { + setSheetOpen(false); + return; + } + openSheet(); + }; + const jump = (id: string) => { if (scrollToHeading) { scrollToHeading(id); @@ -161,12 +235,17 @@ export function ChapterHeadingNav() { setSheetOpen(false); }; - const NavList = (props: { class?: string }) => ( -
    + const NavList = (props: { listRef?: (el: HTMLUListElement) => void; class?: string }) => ( +
      {(item) => (
    • jump(item.id)} > {item.label} @@ -191,12 +271,12 @@ export function ChapterHeadingNav() {
      setRailOpen(true)} - onMouseLeave={() => setRailOpen(false)} - onFocusIn={() => setRailOpen(true)} + onMouseEnter={openRail} + onMouseLeave={scheduleRailClose} + onFocusIn={openRail} onFocusOut={(e) => { if (!e.currentTarget.contains(e.relatedTarget as Node)) { - setRailOpen(false); + scheduleRailClose(); } }} > @@ -218,9 +298,13 @@ export function ChapterHeadingNav() {
      - @@ -232,7 +316,7 @@ export function ChapterHeadingNav() { class="chapter-heading-nav__fab" aria-expanded={sheetOpen()} aria-controls="chapter-heading-sheet" - onClick={() => setSheetOpen((open) => !open)} + onClick={toggleSheet} > On this page @@ -245,6 +329,7 @@ export function ChapterHeadingNav() { /> diff --git a/themes/openfreebooks/templates/partials/chapter-footer-nav.html b/themes/openfreebooks/templates/partials/chapter-footer-nav.html new file mode 100644 index 0000000..61ce18c --- /dev/null +++ b/themes/openfreebooks/templates/partials/chapter-footer-nav.html @@ -0,0 +1,38 @@ +{% set nav_data = load_data(path="data/_generated/chapter-nav.json", format="json") %} +{% set nav_entry = nav_data.byKey[chapter_key] | default(value=false) %} + +