Day 19 — Linear & quadratic functions

Updated

July 30, 2026

Day 19 — Linear & quadratic functions

Stage II · concept day
Goal: Master slope-intercept and point-slope forms; use parallel/perpendicular slope conditions; analyze quadratics via vertex form, discriminant, and completing the square; read graph features.

Why this matters

Linear models are first-order approximations everywhere. Quadratics appear in free-fall idealization, parabolic trajectories, and optimization of \(ax^2+bx+c\). Completing the square unlocks vertex and the quadratic formula.

Theory

Slope of a line

Through points \((x_1,y_1)\), \((x_2,y_2)\) with \(x_1\neq x_2\): \[m=\frac{y_2-y_1}{x_2-x_1}.\]

  • \(m>0\) rising; \(m<0\) falling; \(m=0\) horizontal.
  • Vertical lines: \(x=\) constant; slope undefined (not a function \(y=f(x)\)).

Forms of a line

  • Slope-intercept: \(y=mx+b\) (\(b\) = \(y\)-intercept).
  • Point-slope: \(y-y_1=m(x-x_1)\).
  • Standard: \(Ax+By=C\).
  • Two-point: use slope then point-slope.

Parallel and perpendicular

  • Parallel lines: same slope \(m_1=m_2\) (and distinct intercepts if distinct lines).
  • Perpendicular lines (in plane with standard metric): \(m_1 m_2=-1\) if both slopes defined.
    (Horizontal \(\perp\) vertical.)

Proof sketch of perp condition. Direction vectors \((1,m_1)\), \((1,m_2)\) have dot product \(1+m_1 m_2=0\). \(\square\)

Quadratic functions

\[f(x)=ax^2+bx+c,\qquad a\neq 0.\]

  • Parabola graph; opens up if \(a>0\), down if \(a<0\).
  • Axis of symmetry: \(x=-\dfrac{b}{2a}\).
  • Vertex: \(\biggl(-\dfrac{b}{2a},\; f\biggl(-\dfrac{b}{2a}\biggr)\biggr)\).
  • \(y\)-intercept \(c\); \(x\)-intercepts = roots if real.

Completing the square

\[ \begin{align*} ax^2+bx+c&=a\biggl(x^2+\frac{b}{a}x\biggr)+c\\ &=a\biggl(x+\frac{b}{2a}\biggr)^2 - a\biggl(\frac{b}{2a}\biggr)^2 +c\\ &=a\biggl(x+\frac{b}{2a}\biggr)^2 + \biggl(c-\frac{b^2}{4a}\biggr). \end{align*} \]

Vertex form: \(f(x)=a(x-h)^2+k\) with vertex \((h,k)\).

Discriminant and quadratic formula

From completing the square (or formula derivation): \[x=\frac{-b\pm\sqrt{b^2-4ac}}{2a},\qquad \Delta=b^2-4ac.\]

\(\Delta\) Roots
\(>0\) two distinct real
\(=0\) one real (double)
\(<0\) no real roots (two complex)

Graph features checklist

Vertex, axis, intercepts, direction, max/min value \(k\) if vertex form.

Linear vs quadratic growth (preview)

Tables: linear has constant first differences; quadratic has constant second differences.

Derivation of the quadratic formula

Start from \(ax^2+bx+c=0\) with \(a\neq 0\): \[ x^2+\frac{b}{a}x=-\frac{c}{a}. \] Add \(\bigl(\frac{b}{2a}\bigr)^2\) to both sides: \[ \biggl(x+\frac{b}{2a}\biggr)^2=\frac{b^2}{4a^2}-\frac{c}{a}=\frac{b^2-4ac}{4a^2}. \] If \(\Delta=b^2-4ac\ge 0\), \[ x+\frac{b}{2a}=\pm\frac{\sqrt{\Delta}}{2a},\qquad x=\frac{-b\pm\sqrt{\Delta}}{2a}. \] If \(\Delta<0\), no real \(x\). This is the formula—not a separate magic spell.

Sum and product of roots

If roots \(r,s\) (real or complex), \(r+s=-\frac{b}{a}\) and \(rs=\frac{c}{a}\) for monic-normalized \(ax^2+bx+c\).
Proof. \(a(x-r)(x-s)=a(x^2-(r+s)x+rs)=ax^2+bx+c\). \(\square\)
Axis of symmetry \(x=\frac{r+s}{2}=-\frac{b}{2a}\) when roots real.

Section formula / midpoint

Midpoint of \((x_1,y_1)\) and \((x_2,y_2)\) is \(\bigl(\frac{x_1+x_2}{2},\frac{y_1+y_2}{2}\bigr)\).
The axis \(x=-\frac{b}{2a}\) is the midpoint of the two real roots on the \(x\)-axis.

Worked examples

Example 1 — Slope

Through \((1,2)\) and \((4,8)\): \(m=\frac{6}{3}=2\). Equation \(y-2=2(x-1)\) i.e. \(y=2x\).

Example 2 — Parallel / perp

Line through \((0,1)\) parallel to \(y=3x-2\): \(y=3x+1\).
Perpendicular: slope \(-\frac{1}{3}\), \(y-1=-\frac{1}{3}(x-0)\).

Example 3 — Intercept form to graph

\(2x+3y=6\): \(x\)-intercept \(3\), \(y\)-intercept \(2\).

Example 4 — Vertex formula

\(f(x)=2x^2-8x+3\). \(h=\frac{8}{4}=2\), \(f(2)=8-16+3=-5\). Vertex \((2,-5)\).

Example 5 — Complete the square

\(x^2+6x+5=(x+3)^2-9+5=(x+3)^2-4\). Vertex \((-3,-4)\).

Example 6 — With \(a\neq 1\)

\(2x^2+8x+1=2(x^2+4x)+1=2(x+2)^2-8+1=2(x+2)^2-7\).

Example 7 — Discriminant

\(x^2-4x+4=0\): \(\Delta=0\), root \(x=2\).
\(x^2+x+1=0\): \(\Delta=1-4=-3<0\), no real roots.

Example 8 — Quadratic formula

\(2x^2-3x-2=0\): \(\Delta=9+16=25\), \(x=\frac{3\pm 5}{4}\). \(x=2\) or \(x=-\frac{1}{2}\).

Example 9 — Factored graph

\(f(x)=(x-1)(x-4)=x^2-5x+4\). Roots \(1,4\); vertex at \(x=2.5\), \(f(2.5)=-2.25\).

Example 10 — Max problem

Rectangular enclosure three sides fence \(L=20\), side \(x\), depth \(y\), \(2x+y=20\), area \(A=x(20-2x)=20x-2x^2\). Vertex \(x=5\), \(A=50\).

Example 11 — Linear table

\(x=1,2,3,4\); \(y=3,5,7,9\): first differences \(2,2,2\) → linear slope \(2\).

Example 12 — Quadratic table

\(y=1,4,9,16\): first diff \(3,5,7\); second \(2,2\) → quadratic.

Example 13 — Perp check

Slopes \(2\) and \(-\frac{1}{2}\): product \(-1\). ✓

Example 14 — From vertex

Vertex \((1,-2)\), passes through \((3,6)\), \(a>0\): \(y=a(x-1)^2-2\). \(6=a\cdot 4-2\Rightarrow 4a=8\), \(a=2\). \(y=2(x-1)^2-2\).

Example 15 — Full quadratic formula derivation numeric

\(2x^2-4x-6=0\). Divide by 2: \(x^2-2x-3=0\). \((x-1)^2=4\), \(x-1=\pm 2\), \(x=3\) or \(x=-1\). Formula: \(\Delta=16+48=64\), \(x=\frac{4\pm 8}{4}\).

Example 16 — Sum/product of roots

\(x^2-5x+6=0\): roots \(2,3\); sum \(5=-(-5)\); product \(6\). Useful check after solving.

Example 17 — No real intersection line-parabola

\(y=x^2\) and \(y=-x-1\): \(x^2+x+1=0\), \(\Delta=-3<0\)—no real intersection.

Example 18 — Horizontal and vertical

Through \((3,-2)\): horizontal \(y=-2\) (slope \(0\)); vertical \(x=3\) (undefined slope, not \(y=f(x)\)).

Example 19 — Second differences proof sketch

\(f(n)=an^2+bn+c\). First difference \(\Delta f(n)=f(n+1)-f(n)=a(2n+1)+b\). Second \(\Delta^2 f(n)=\Delta f(n+1)-\Delta f(n)=2a\). Constant \(2a\).

Example 20 — Optimizing a quadratic profit

\(P(x)=-x^2+12x-20\) (toy). Vertex at \(x=6\), \(P(6)=16\). Domain if \(x\) is quantity in \([0,12]\): max at vertex inside interval.

Exercises

Easy

  1. Slope through \((0,0)\) and \((5,10)\).
  2. Equation: slope \(-3\), \(y\)-intercept \(4\).
  3. Vertex of \(y=x^2-4x+1\) using \(-b/(2a)\).
  4. Discriminant of \(x^2+2x+5\).
  5. Parallel to \(y=-x+1\) through \((2,3)\).

Medium

  1. Point-slope then slope-intercept: through \((-1,4)\) and \((3,2)\).
  2. Perpendicular to \(y=\frac{2}{3}x-1\) through \((0,0)\).
  3. Complete the square: \(x^2-5x+6\); find vertex form.
  4. Complete the square: \(3x^2-12x+5\).
  5. Solve \(x^2-2x-15=0\) by formula and by factoring.
  6. Find max/min of \(f(x)=-2x^2+8x-1\).
  7. \(x\)-intercepts of \(f(x)=x^2-3x-10\).
  8. Write equation of vertical and horizontal lines through \((2,-5)\).

Hard / proof

  1. Derive the quadratic formula by completing the square for \(ax^2+bx+c=0\).
  2. Prove that vertex \(x\)-coordinate is \(-b/(2a)\) using axis of symmetry or calculus-free: average of roots when \(\Delta\ge 0\), or complete square.
  3. Prove: lines with slopes \(m\) and \(-\frac{1}{m}\) (\(m\neq 0\)) are perpendicular via direction vectors.
  4. Show constant second differences for \(f(n)=an^2+bn+c\) on integers \(n\).
  5. For \(f(x)=ax^2+bx+c\) with \(a>0\), prove \(f(x)\ge f\bigl(-\frac{b}{2a}\bigr)\) for all \(x\).
  6. Find all lines through \((1,2)\) with slope \(\pm 1\); equations.
  7. Relate \(\Delta\) to factoring over reals.

Challenge / CS-flavored

  1. Linear interpolation between points \((x_0,y_0)\), \((x_1,y_1)\): write \(y\) as function of \(x\).
  2. Complexity: \(T(n)=an+b\) vs \(S(n)=cn^2\)—for large \(n\), which dominates? (qualitative)
  3. Screen coordinates: line from pixel \((0,0)\) to \((w,h)\); slope.
  4. Projectile height \(h(t)=-5t^2+20t+2\): max height and time.
  5. Fit: uniquely determine \(y=mx+b\) from two distinct points—why unique?

Intercept form of a line

If \(x\)-intercept \(a\neq 0\) and \(y\)-intercept \(b\neq 0\): \(\frac{x}{a}+\frac{y}{b}=1\).

Distance from point to line (formula stated)

For line \(Ax+By+C=0\) and point \((x_0,y_0)\): \[\mathrm{dist}=\frac{|Ax_0+By_0+C|}{\sqrt{A^{2}+B^{2}}}.\] Useful for geometry checks; derive later via projection if desired.

Vertex as optimization

For \(a>0\), vertex is global minimizer; \(a<0\) maximizer. Business “profit quadratic” word problems use this.

Extra exercises

  1. Derive slope-intercept form from two points algebraically.
  2. Complete the square for \(5x^{2}-20x+6\).
  3. Find \(k\) so \(x^{2}+kx+9\) is a perfect square trinomial.
  4. Equation of line parallel to \(3x-y=2\) with \(y\)-intercept \(-4\).
  5. Show the axis of symmetry is midway between real roots when \(\Delta>0\).

CS connection

Linear regression is fitting lines; quadratic forms appear in optimization objectives. Bresenham-style line drawing uses slopes. Discriminant decides existence of real intersection. Vertex form is “change of coordinates” to center a feature.

Common pitfalls

Pitfall What to do instead
Slope \(\frac{x_2-x_1}{y_2-y_1}\) Rise over run: \(\Delta y/\Delta x\)
Forgetting \(a\) when completing square Factor \(a\) out of \(x\) terms first
\(\Delta\) formula wrong \(b^2-4ac\)
Parallel vs equal lines Same slope, check intercepts
\(m_1 m_2=1\) for perp Product \(-1\)
Vertical line as \(y=mx+b\) Cannot; \(x=\) const

Fully worked extra examples

E15 — Complete the square with \(a\neq 1\) fully.
\(3x^{2}-12x+7=3(x^{2}-4x)+7=3(x^{2}-4x+4-4)+7=3((x-2)^{2}-4)+7=3(x-2)^{2}-12+7=3(x-2)^{2}-5\).
Vertex \((2,-5)\); opens up; min \(-5\).

E16 — Quadratic formula numeric.
\(x^{2}-x-1=0\): \(\Delta=5\), \(x=\frac{1\pm\sqrt{5}}{2}\). Golden ratio \(\varphi=\frac{1+\sqrt{5}}{2}\).

E17 — Parallel through a point.
Line \(2x-3y=6\) has slope \(\frac{2}{3}\) (rewrite \(y=\frac{2}{3}x-2\)). Through \((3,1)\): \(y-1=\frac{2}{3}(x-3)\).

E18 — Intercept form.
Intercepts \(4\) and \(-2\): \(\frac{x}{4}+\frac{y}{-2}=1\Rightarrow \frac{x}{4}-\frac{y}{2}=1\). Multiply by \(4\): \(x-2y=4\).

End-of-day synthesis problems

S1. Line through \((2,-1)\) and \((-4,5)\): slope, point-slope, slope-intercept.

S2. Line through \((0,3)\) perpendicular to \(y=\frac{1}{2}x-1\).

S3. Complete the square: \(f(x)=2x^{2}-12x+5\); vertex and min value.

S4. Derive quadratic formula from \(ax^{2}+bx+c=0\) by completing the square (full writeup).

S5. Discriminant cases for \(x^{2}+kx+1=0\) as \(k\) varies.

S6. Graph features of \(f(x)=-(x-2)^{2}+3\): vertex, direction, intercepts.

S7. Fence problem: three sides, total \(30\) m, maximize area; optimal dimensions.

S8. Show second differences of \(n^{2}\) equal \(2\) for consecutive integers \(n\).

Deep dive — Geometry of \(ax^2+bx+c\)

Completing the square is a translation of the graph: \(y-k=a(x-h)^2\) shifts the basic parabola \(y=ax^2\) so the vertex sits at \((h,k)\). Stretch \(|a|\) and reflect if \(a<0\). Linear functions are degenerate “parabolas with \(a=0\)”—constant first differences, infinite “vertex” nowhere. Parallel lines never meet; perpendicular slopes multiply to \(-1\) because direction vectors are orthogonal under the dot product.

Synthesis

Lines: slope, intercepts, parallel/perp. Quadratics: complete the square → vertex form; discriminant → number of real roots; formula is completed square solved for \(x\). Optimization of \(ax^2+bx+c\) on \(\mathbb{R}\) is reading the vertex. Tables: first differences linear, second quadratic.

S9. Derive \(x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\) for \(a=3\), \(b=-6\), \(c=0\) both by factoring and by formula.

S10. Line through \((1,1)\) perpendicular to \(2x+y=4\); slope-intercept form.

S11. For \(f(x)=x^2-6x+5\), give vertex, roots, and \(y\)-intercept without a calculator.

S12. Prove: if \(\Delta>0\), axis of symmetry is midpoint of the two roots.

Checkpoint

  • Write line equations from slope/points
  • Use parallel and perpendicular conditions
  • Convert quadratic to vertex form by completing the square
  • Use discriminant and quadratic formula
  • Identify vertex, intercepts, max/min
  • S4 proof-level derivation once

Write two takeaways in your own words.

Quick reference card

Topic Formula
Slope \(m=\frac{y_2-y_1}{x_2-x_1}\)
Line \(y=mx+b\) or \(y-y_1=m(x-x_1)\)
Parallel \(m_1=m_2\)
Perpendicular \(m_1 m_2=-1\)
Vertex \(x\) \(-b/(2a)\)
Vertex form \(a(x-h)^{2}+k\)
Discriminant \(\Delta=b^{2}-4ac\)
Quadratic formula \(\frac{-b\pm\sqrt{\Delta}}{2a}\)

Tomorrow

Day 20 — Exponential growth. \(a^x\) growth; half-life/doubling; linear vs exp tables; compound interest; logs as inverse of exp.