Home
Login

Color

Indigo
Red
Green
Teal
Blue
Purple
Rose

Mode

Light
বাং

See a quadratic turn into a perfect square, one tile at a time

Completing the square means rewriting x² + bx + c as (x + b/2)² − (b/2)² + c, so the unknown appears only once, inside a square. You add the missing corner (b/2)² to make the square perfect, subtract it again to keep the value, then take a square root. It solves any quadratic equation and gives the vertex of its parabola.

x² squarebx stripRed tile = negativeMissing cornerConstant term

Working, step by step

  1. 1. Half the coefficient of xb / 2a = 6 / 2 = 3; (3)² = 9
  2. 2. Write as a squarex² + 6x + 5 = (x + 3)² − 9 + 5 = (x + 3)² − 4
  3. 3. Vertex(−3, −4)
  4. 4. RootsΔ = 6² − 4×1×5 = 16; x = −5, −1
Speed

Controls

6
5
0

Readings

Quadratic
x² + 6x + 5 = 0
Half the x coefficient
3
Area of the missing corner
9
Completed square
(x + 3)² − 4
Vertex
(−3, −4)
Discriminant, Δ
16
Roots
−5, −1
Kind of roots
Two different real roots

How to use this simulation

  1. Before touching anything, look at the tiles: the simulation opens on x² + 6x + 5. The big blue square is x², the strip beside it is the 6x part, and the green block is the constant 5. Press Play and the strip is cut in half, one half moves under the square, and a missing corner appears.
  2. Drag the “Step” slider from 0 to 4 to move through the stages by hand. Step 1 splits the strip, step 2 fills the dashed corner of area 9, step 3 shows the finished square (x + 3)² and step 4 reads off the roots −5, −1 on the small parabola.
  3. Change b. Make it negative and the strip turns red: negative tiles. The corner stays positive, because a negative number squared is positive. Try an odd b as well and watch the half-strips become fractions.
  4. Change c. Watch the two small squares under the parabola. When the accent square (b/2)² is bigger than the constant, the parabola crosses the x-axis. When it is smaller, the curve floats above the axis and the simulation says “No real roots”.
  5. Tick “Let the x² coefficient a differ from 1” to bring in a leading coefficient. The tiles are then drawn after dividing through by a, which is exactly the first step you must write in an exam.
  6. Leave “Show the working” on. Under the picture, every line of the solution appears with your own numbers: the half, the corner, the square, the vertex and the roots.

Al-Khwarizmi really did complete a square

Around the year 820, in Baghdad, the scholar al-Khwarizmi wrote the book whose title gave us the word “algebra”. One of its first problems is a square and 10 roots equal 39. In modern symbols that is x² + 10x = 39. He had no letters and no negative numbers, so he solved it with a drawing.

Draw a square of side x. Hang a strip of width 5 on one side and another on the bottom, because half of 10 is 5. Together the three pieces have area 39, but a corner is missing: a small square of side 5, area 25. Add it to the picture and you must add it to the 39 too. The big square now has area 64, so its side is 8.

The side is x + 5, so x = 8 − 5 = 3. Check it: 3² + 10×3 = 39. The negative answer −13 was ignored in 820, since a length cannot be negative, but today we keep it. This page is that drawing, made to move.

Perfect squares, from zero

A perfect square is something multiplied by itself. Numbers first: 25 is 5 × 5. In algebra, (x + 3) multiplied by itself is x² + 3x + 3x + 9 = x² + 6x + 9. Two middle terms of 3x merge into one 6x.

Look at the answer and spot the pattern. The middle coefficient is double the number in the bracket, and the last term is the number in the bracket squared. Go the other way and you have the recipe for completing the square: half the middle coefficient, squared, is the constant that makes a perfect square.

SquareExpanded
(x + 1)²x² + 2x + 1
(x + 2)²x² + 4x + 4
(x + 3)²x² + 6x + 9
(x + 4)²x² + 8x + 16
(x + 5)²x² + 10x + 25

Words you will meet

Keep this table at hand. The same ideas go by different names in different textbooks.

TermMeaning
Quadratic equationAn equation of the form ax² + bx + c = 0 with a ≠ 0
RootA value of x that makes the equation true (also called a solution or zero)
Perfect squareAn expression of the form (x + h)²
Completing the squareRewriting x² + bx + c as (x + b/2)² plus a constant
VertexThe turning point of the parabola, the lowest or highest point
Vertex forma(x + h)² + k, where (−h, k) is the vertex
DiscriminantΔ = b² − 4ac, which tells how many real roots there are
Axis of symmetryThe vertical line x = −b/2a through the vertex

The tile picture: what you see in the simulation

Think of x as an unknown length. The square of side x has area x², the blue tile. A strip x long and 1 wide has area x. Putting b of those strips side by side makes one strip of area bx, the second colour. The constant c is a block of c unit squares, green.

A tile is positive when it is solid and negative when it is red. If b is negative, the whole strip is red. That is why a red strip is still a strip with the same length: the colour only records the sign.

Cut the strip in half

The strip has area 6x, which is width 6 and length x. Cut it down its length into two strips of width 3. One is glued on the right of the square, the other under it. Press Play and watch the second half slide round.

The missing corner

Now the L-shape has a notch at the bottom right. It is a square of side 3, so its area is 3² = 9. Fill it and the picture is a perfect square of side x + 3.

The fill costs 9, so the identity must give it back: x² + 6x = (x + 3)² − 9.

Where the constant goes

The constant 5 was never part of the square. It rides along. In the end x² + 6x + 5 = (x + 3)² − 9 + 5 = (x + 3)² − 4. The two small squares at the right of the simulation compare the corner with the constant: the bigger one decides whether the parabola dips below the axis.

The algebra, step by step

Write the recipe as five lines. Use x² + 6x + 5 = 0 as the example, the simulation’s own starting point.

Step 1: make the x² coefficient 1

If a is not 1, divide the whole equation by a. This is the line students forget most often. Our example already has a = 1, so nothing changes; the next example, with a = 2, does it for real.

Step 2: halve the x coefficient and square it

Half of 6 is 3. Squared, that is 9. This is the area of the missing corner.

(b/2)² = (3)² = 9the number to add and subtract

Step 3: add and subtract it

Adding 9 alone would change the value, so we add and subtract it. Then the first three terms are a perfect square.

x² + 6x + 5 = (x² + 6x + 9) − 9 + 5value unchanged

Step 4: write the bracket as a square

The bracket is the square of x + 3, so the quadratic becomes (x + 3)² − 4.

x² + 6x + 5 = (x + 3)² − 4vertex form

Step 5: solve or read the vertex

To solve x² + 6x + 5 = 0, move the constant across: (x + 3)² = 9 − 5 = 2². Take the square root of both sides, with a plus and a minus, and subtract 3: x = −5, −1. The vertex is (−3, −4): the lowest point of the curve.

Where the quadratic formula comes from

The famous formula is not magic. It is completing the square done once, with letters, so you never have to do it again. Follow the six lines below; each is the previous one with one move.

ax² + bx + c = 0start with any quadratic, a ≠ 0

x² + (b/a)x + c/a = 0divide by a

x² + (b/a)x + (b/2a)² = (b/2a)² − c/aadd (b/2a)² to both sides

(x + b/2a)² = (b² − 4ac) / 4a²the left side is a perfect square; combine the right side

x + b/2a = ± √(b² − 4ac) / 2atake the square root, with both signs

x = (−b ± √(b² − 4ac)) / 2asubtract b/2a and put over 2a: the quadratic formula

Try it in the simulation

Five experiments. Each takes under a minute and each teaches something an exam will ask.

  • Reset, then slide c to 9. The corner and the constant become the same size, Δ = 0, and there is one repeated root, −3. The parabola just touches the x-axis.
  • Push c up to 13. The constant now beats the corner. Δ = −16, the curve floats above the axis, and the roots readout says “No real roots”.
  • Set b to −6. The strip turns red and the bracket becomes (x − 3)². The vertex moves to the right side of the axis, to x = 3.
  • Set b to 0. There is no strip to cut, no corner, and x² + c = 0 is already a square. This is the easy special case.
  • Tick the a toggle and set a = 2. Watch the tiles redraw after dividing through by 2, while the readings show the original quadratic. The roots are unchanged by the division, but the vertex height is multiplied back by a.

Solved problems

Every number below is worked out by the same code that drives the simulation, so you can check each line on the screen.

Problem 1: solve x² + 6x + 5 = 0

Half of 6 is 3, squared 9. So x² + 6x + 5 = (x + 3)² − 9 + 5 = (x + 3)² − 4. Setting it to zero gives (x + 3)² = 2², so x + 3 = ± 2. Therefore x = −5 or x = −1.

Problem 2: a negative middle term

Solve x² − 8x + 7 = 0. Half of −8 is −4; the bracket takes the sign of that half: (x − 4)². The corner is 16, so x² − 8x + 7 = (x − 4)² − 9. Then (x − 4)² = 3², giving x = 1 or x = 7.

Problem 3: no real roots

Solve x² + 4x + 9 = 0. The corner is 4 and x² + 4x + 9 = (x + 2)² + 5. A square is never negative, so (x + 2)² would have to equal −5: impossible. There are no real roots, and Δ = −20 agrees. The vertex (−2, 5) sits above the axis.

Problem 4: the leading coefficient is not 1

Solve 2x² + 8x − 10 = 0. First divide by 2: x² + 4x − 5 = 0. Half of the middle coefficient squared is 4, so x² + 4x − 5 = (x + 2)² − 9. Then (x + 2)² = 3², so x = −5 or x = 1. As vertex form, 2x² + 8x − 10 = 2(x + 2)² − 18.

Problem 5: roots that are not whole numbers

Solve x² + 5x + 3 = 0. Half of 5 is 5/2; squared, 25/4. So x² + 5x + 3 = (x + 5/2)² − 13/4. Setting this to zero, (x + 5/2)² = 25/4 − 3, and x = (−5 ± √13) / 2. As decimals, x ≈ −4.30 or x ≈ −0.70. Leave the surd form unless the question asks for decimals.

Problem 6: find the minimum

Find the least value of x² − 6x + 13. Complete the square: x² − 6x + 13 = (x − 3)² + 4. The square is never below zero, so the least value is 4, reached at x = 3.

Problem 7: find k

For which k does x² + kx + 9 = 0 have two equal roots? Equal roots mean the corner equals the constant: (k/2)² = 9, so k = ± 6.

Quadratic with b = 6Δ = b² − 4acKind of rootsRoots
x² + 6x + 516Two real roots−5, −1
x² + 6x + 90One repeated root−3
x² + 6x + 13−16No real roots—

Common mistakes

These are the places marks leak away. Each has a quick fix.

  • Forgetting to divide by a. If a ≠ 1 divide the whole equation first, constant included, or the corner will be wrong.
  • Taking the wrong sign. The bracket is x + b/2, not x − b/2. A negative b gives (x − something)², and the root is x = +something ± the spread.
  • Adding the corner but not subtracting it. If you add (b/2)² on one side of an equation you must add it on the other side too.
  • Squaring b instead of b/2. The corner is (b/2)², not b², and not b/2 squared wrongly as b²/2.
  • Dropping the ± when taking the square root. Both signs give a root; losing one loses half the answer.
  • Declaring a root when the right side is negative. If the square equals a negative number, there are no real roots.

Why this matters beyond one equation

The vertex form is the practical payoff. x² + 6x + 5 has its vertex at (−3, −4) just by reading (x + 3)² − 4. With a positive coefficient the parabola opens up and this is the minimum; with a negative one it opens down and it is the maximum.

Maximum area with a fixed fence

A farmer has 40 metres of fence for a rectangle with one side x. The area is x(20 − x) = −x² + 20x. Completing the square gives −(x − 10)² + 100, so the largest area is 100 square metres at x = 10: a square field.

Circles

The same move turns x² + y² + Dx + Ey + F = 0 into a circle. For x² + y² − 6x + 4y − 12 = 0, complete the square in x and in y: (x + 3)² + (y − 2)² = 25. The centre is (3, −2) and the radius is 5.

Calculus and physics

Integrals of 1/(x² + bx + c) need a completed square. The height of a ball, h = −5t² + 20t + 1, peaks where the bracket is zero. Wherever something rises and falls, there is a vertex.

Exam corner

Examiners in CBSE Class 10, GCSE and A level all love this method, because it is the only one that works for every quadratic and shows your reasoning. Marks go to the layout.

  • Write “divide by a” as its own line when a ≠ 1.
  • Write the corner (b/2a)² explicitly before using it.
  • Show the line “= (x + …)² − …”. That line carries the method mark.
  • Leave a root as a surd unless told to give decimals, and say to how many places if you do.
  • If asked for the nature of roots, quote Δ before solving.

Quick revision

Pin these to the wall before the exam.

  • Perfect square: (x + h)² = x² + 2hx + h².
  • To complete x² + bx, add (b/2)².
  • x² + bx + c = (x + b/2)² − (b/2)² + c.
  • Vertex of ax² + bx + c: (−b/2a, c − b²/4a).
  • Roots: x = (−b ± √(b² − 4ac)) / 2a.
  • Δ > 0 two real roots, Δ = 0 one repeated root, Δ < 0 no real roots.
  • A negative b gives a red strip, a negative bracket and the same corner.

Frequently asked questions

What does completing the square mean?

It means rewriting x² + bx + c as (x + b/2)² plus a constant. You add and subtract (b/2)² so the x terms become a perfect square. For x² + 6x + 5 the result is (x + 3)² − 4.

Why do we add (b/2)²?

Because that is the area of the corner missing when you wrap two half-strips of width b/2 round an x² square. Adding it fills the square exactly.

What if a is not 1?

Divide every term by a first. For 2x² + 8x − 10 that gives x² + 4x − 5. After completing the square you can multiply back by a to get 2(x + 2)² − 18.

When is completing the square better than factorising?

When the roots are not whole numbers, when you want the vertex, or when the quadratic does not factorise over integers. Factorising only works when you can spot the factors.

How does it prove the quadratic formula?

Do it once with letters. Dividing by a, adding (b/2a)² to both sides and taking square roots yields x = (−b ± √(b² − 4ac)) / 2a.

Can a quadratic have no real roots?

Yes. When the corner (b/2a)² is smaller than c/a, the right-hand side is negative and a square cannot equal it. x² + 4x + 9 is an example, with Δ = −20.

How do I find the vertex of a parabola?

Complete the square. In a(x + h)² + k the vertex is (−h, k). For x² + 6x + 5, it is (−3, −4).

Keep studying this topic

The animation made the idea click; now turn it into marks. Syllabus, suggestions, textbooks and admission-test guides are below.

More math animations

Grade 8–10

Pythagorean Theorem

The Pythagorean theorem explained: formula a² + b² = c², two proofs you can watch, the converse, Pythagorean triples and 10 worked examples. Drag the triangle yourself.

Grade 10–11

Trigonometric Ratios and the Unit Circle

Drag a point round the unit circle and watch sin, cos and tan change. Standard angle table, ASTC signs, identities, radians and graphs, with solved examples.

Grade 9–11

Quadratic functions and their graphs

Drag the vertex and change a, b, c to see how a quadratic function graph moves. Learn factoring, completing the square, the quadratic formula and discriminant.

Grade 9–10

Circle theorems

All the circle theorems with drag-and-check diagrams: angle at the centre, same segment, semicircle, cyclic quadrilateral, chords, tangents and alternate segment.

Grade 9–10

Heights and distances: elevation and depression angles

What angle of elevation and angle of depression mean, how the height-and-distance formula works, and how two observations solve a tower's height without ever measuring it — with an interactive simulation and solved problems.

Grade 9–11

Probability: experimental vs theoretical probability

What probability means, how the sample-space formula P(E) = n(E)/n(S) works, and why experimental frequency edges closer to theoretical probability the more you flip, roll or draw — with a coin, dice and coloured-ball simulator.

Grade 10–11

Arithmetic and Geometric Sequences

Learn the arithmetic and geometric sequence formulas for the nth term and sum, Gauss's pairing trick, and the sum-to-infinity formula a/(1−r), with a drag-and-slide bar-chart simulation and worked examples.

Grade 9–10

Mean, Median and Mode

Learn the mean, median and mode formulas, why the median resists an outlier while the mean does not, and the grouped-data median/mode formulas, by dragging points on a number line, with worked examples.

Grade 7–11

Sets and Venn Diagrams

Shade union, intersection, difference and complement on a live Venn diagram, drop numbers into regions, check n(A ∪ B) and test De Morgan’s laws, with solved problems.

Grade 8–10

Linear equations: graphs, slope and simultaneous pairs

See slope, intercepts and angle on a straight line, then graph two linear equations to find where they meet. Learn the ratio test for one, none or infinite solutions.

Grade 10–12

Graphs of sin, cos and tan

Plot y = A sin(Bx + C) + D with sliders: see amplitude, period, phase shift, range and the asymptotes of tan live. Trigonometric graphs with solved examples.

Grade 7–10

Area of a Circle: Proof, Formula and Solved Problems

Cut a circle into slices, slide them into a rectangle and watch the area become πr². Free interactive simulation with circumference, pi, sectors, arcs and solved problems.

Grade 8–10

Volume and Surface Area of Solids: Cube, Cuboid, Cylinder, Cone, Sphere

Rotate six solids in 3D, unfold their nets and pour a cone into a cylinder to see why it takes exactly three. Free simulation with volume, CSA and TSA formulas and solved problems.

Grade 8–10

Similar Triangles: Scale Factor, AA, SSS, SAS and Shadow Heights

Scale a triangle with a slider and watch angles stay equal, side ratios stay k and area grow by k². Free interactive similar triangles simulation with AA, SSS, SAS tests and shadow problems.

Grade 9–11

Coordinate Geometry: Distance, Midpoint, Slope, Section Formula and Locus

Drag points on a grid and watch the distance formula, midpoint, slope and section formula update live. Free coordinate geometry simulation with the perpendicular-bisector locus and solved problems.

Grade 11–12

Conic Sections: Circle, Ellipse, Parabola and Hyperbola

Tilt a plane through a double cone and watch a circle, ellipse, parabola or hyperbola appear, with its standard equation, foci and eccentricity. Free conic sections simulation with solved problems.

Grade 9–11

Function Transformations: Shifts, Stretches and Reflections

Pick x², |x|, √x, sin x or 2^x and drag sliders for a, b, h and k. Watch shifts, stretches, squeezes and reflections move the graph, with the parent faded behind. Free simulation with solved problems.

Grade 11–12

Derivative as the Slope of a Tangent: Secant to Tangent

Drag a point P on x², x³, sin x, eˣ or 1/x and shrink the gap h to zero. Watch the secant become the tangent and its slope become the derivative, with the derivative graph below. Free simulation.

Grade 11–12

Riemann Sums and Integration: Area Under a Curve

Cut the area under x², x³, sin x, eˣ or √x into up to 100 strips and compare left, right, midpoint and trapezoid sums with the exact integral. Watch the error melt away. Free simulation.

Grade 11–12

Limits and the ε–δ Definition: A Visual Guide

See the epsilon-delta definition of a limit. Pick a function, shrink ε and watch the δ band follow it, with left and right limits, a hole, sin x / x and a jump where no δ works. Free simulation.

Grade 11–12

3D Vectors: Sum, Dot Product and Cross Product

Drag to rotate two 3D vectors. See the sum as a parallelogram, the dot product as a shadow and an angle, and the cross product as a perpendicular arrow whose length is the area. Free simulation.

Grade 11–12

Matrix Transformations: Rotation, Reflection, Shear and the Determinant

Change a 2×2 matrix and watch the grid, a unit square and an F-shape move. See where i-hat and j-hat land, the determinant as signed area, and the inverse. Free simulation.

Grade 11–12

Complex Numbers: Sum, Product, Powers and Roots on the Argand Plane

Drag two complex numbers on the Argand plane. See the sum as a parallelogram, the product as a rotation and stretch, conjugates, powers as a spiral and roots of unity. Free simulation.

Grade 9–12

Binary Number System: Place Value, Conversion and Addition

Flip bits and see decimal, binary, octal and hex change together. Watch conversion by repeated division by 2, regrouping into octal and hex, and binary addition with carries. Free, with worked examples.

Animations in other subjects

Physics

Refraction of light

Physics

Ohm's law

Physics

Projectile motion

Physics

Simple pendulum

Physics

Electric field

Physics

Wave interference

Physics

Free Fall

Physics

Lens ray diagrams

Physics

Newton's Laws of Motion

Physics

Spherical mirror ray diagrams

Physics

Electromagnetic Induction

Physics

Conservation of Momentum and Collisions

Physics

Work, Energy and Power

Physics

Inclined Plane

Physics

Uniform circular motion

Physics

Transverse and Longitudinal Waves

Physics

Levers and moments

Physics

Centre of mass

Physics

Spring-mass SHM

Physics

Vector addition: triangle and parallelogram laws

Physics

Relative velocity: trains and river crossing

Physics

Kepler's laws and elliptical orbits

Physics

Newton’s law of gravitation, g and satellites

Physics

Standing waves in strings and pipes

Physics

Resonance tube and the speed of sound

Physics

Beats: when two close notes pulse

Physics

Doppler effect: moving sources, listeners and sonic booms

Physics

Prism, dispersion of light and the rainbow

Physics

Kirchhoff’s laws: junction rule and loop rule

Physics

Wheatstone bridge and metre bridge

Physics

Single-slit diffraction

Physics

Defects of the human eye and their correction

Physics

Polarisation of light: Malus’s law and Brewster’s law

Physics

Charging and discharging a capacitor: the RC time constant

Physics

Magnetic field lines: bar magnet, current-carrying wire and solenoid

Physics

AC generator

Physics

Transformer

Physics

Heat transfer: conduction, convection and radiation

Physics

Photoelectric effect: Einstein’s equation and the stopping potential

Physics

Motor effect: force on a current-carrying wire and the DC motor

Physics

Gas molecules and kinetic theory: pressure, temperature and speed

Physics

The semiconductor diode: p–n junction, I–V curve and rectifier

Physics

Radioactive decay: half-life, the decay law and penetration

Physics

The Bohr atom: orbits, energy levels and the hydrogen spectrum

Chemistry

Structure of the atom

Chemistry

Acids, Bases and the pH Scale

Chemistry

Electron configuration

Chemistry

Gas laws: Boyle, Charles, Gay-Lussac, Avogadro and PV = nRT

Chemistry

How an Ionic Bond Forms

Chemistry

Electrolysis and Faraday’s Laws

Chemistry

Covalent Bond

Chemistry

Periodic Trends

Chemistry

Reaction rate and collision theory

Chemistry

States of matter: solid, liquid, gas and the heating curve

Chemistry

Atomic orbitals: the shapes of s, p and d, quantum numbers and nodes

Chemistry

Molecular shapes and VSEPR theory: bond pairs, lone pairs and angles

Chemistry

The mole concept: molar mass, Avogadro’s number and molar volume

Chemistry

Diffusion and effusion: Graham’s law of gases

Chemistry

Balancing chemical equations: method, examples and practice

Chemistry

Chemical equilibrium: the equilibrium constant Kc and Le Chatelier’s principle

Chemistry

Titration: finding an unknown concentration with a burette and an indicator

Chemistry

Galvanic cell: the Daniell cell, EMF and the Nernst equation

Chemistry

Redox reactions: oxidation numbers, electron transfer and half-equations

Chemistry

Hydrocarbons: alkanes, alkenes, alkynes and structural isomers in 3D

Chemistry

Functional groups: alcohols, aldehydes, ketones, acids, esters and amines

Chemistry

Polymerisation: addition and condensation polymers, polythene and nylon

Chemistry

Separation techniques: filtration, distillation, chromatography, crystallisation

Chemistry

Crystal lattice: SC, BCC and FCC unit cells, packing efficiency and density

Chemistry

Radioactivity: Alpha, Beta, Gamma Decay and Half-Life

Biology

Mitosis cell division

Biology

Diffusion and Osmosis

Biology

Photosynthesis

Biology

The human heart: structure and function

Biology

Mendelian Genetics

Biology

DNA Replication

Biology

Cellular Respiration

Biology

Enzyme Action

Biology

The Nerve Impulse and the Action Potential

Biology

The Nephron and Urine Formation

Biology

Meiosis Cell Division

Biology

Digestive System

Biology

Breathing Mechanism: Inhalation and Exhalation

Biology

Protein synthesis

Biology

Blood circulation: double circulation and cardiac output

Biology

Cell structure and organelles: plant cell vs animal cell

Biology

Reflex action and the reflex arc

Biology

The human eye: parts, image formation and accommodation

Biology

Muscle contraction and the sliding-filament model

Biology

Transport in plants: xylem, phloem and transpiration

Biology

Food chain and food web: energy flow and the 10 % rule

Biology

Population growth: exponential and logistic curves

Biology

Natural selection: peppered moths and the sooty tree

Biology

Immune response: primary and secondary antibody response

Biology

Pollination and fertilisation