Drag a dot to change it, or use the sliders
Controls
Data type
Readings
- Mean, x̄
- 6.00
- Median
- 5.00
- Mode
- 5
- Range (highest − lowest)
- 8
- Standard deviation, σ
- 2.62
How to use this simulation
- In raw-data mode, drag any dot on the number line: the mean, median and mode markers update instantly.
- Tick "Add an outlier value": the mean marker jumps a long way, while the median marker barely shifts.
- Watch the shaded band: it shows the mean ± 1 standard deviation, and it widens as the data spreads out more.
- Switch to grouped-data mode and slide each class interval's frequency: watch the median class and modal class change.
- Set one class frequency to zero: its histogram bar disappears, and the median and mode both shift toward the surviving classes.
A class test and a very large salary
Seven friends score 2, 4, 5, 5, 7, 9, 10 out of 10 on a class test. If someone asks "how did your group do", and you can only answer with one number, what do you say? Finding that one representative number, in three different ways, is what this page is about.
Now imagine a small office where nine employees earn roughly the same modest salary, and a tenth person — the owner — earns many times more than everyone else. Report the “average salary” and you get a number nobody in the office is actually close to. Report the “median salary” instead, and that one very large number barely moves it. That gap is one of the most useful lessons in statistics.
The simulation above shows exactly this: dots sit on a number line, and ticking the outlier switch adds one far-away value, just like that office owner's salary.
Starting from zero: central tendency and spread
Summarizing a set of numbers with one typical value is called a measure of central tendency. There are three common ones: the mean, the median and the mode.
The mean is every value added up and divided by how many there are: x̄ = (Σx) ÷ n. The median is the middle value once the data is sorted from smallest to largest (the average of the two middle values if there is an even number of them). The mode is whichever value occurs most often.
Two groups can share the same mean and still be spread out very differently. That is measured separately, by a measure of dispersion: the simplest is the range (highest minus lowest), and a more careful one is the standard deviation, which averages how far every value sits from the mean.
Key terms
Get the vocabulary straight before the formulas; definition questions come straight from this table.
| Term | Symbol | What it means |
|---|---|---|
| Mean | x̄ | The sum of every value, divided by how many values there are |
| Median | Median | The middle value once the data is sorted from smallest to largest |
| Mode | Mode | The value that occurs most often in the data |
| Range | Range | The highest value minus the lowest value |
| Standard deviation | σ | The square root of the average squared distance from the mean |
| Outlier | — | A value that sits unusually far from the rest of the data |
| Class width | h | The width of one class interval in grouped data (upper limit minus lower limit) |
| Median class | — | The class where the running total of frequencies first passes n/2 |
The mean, median and mode formulas
Each formula follows directly from its definition.
x̄ = (Σx) / nSum every value, divide by how many there are
Median = the ((n+1)/2)th value, if n is oddIf n is even, average the two middle values
σ = √( Σ(x − x̄)² / n )Average the squared distance from the mean, then take the square root
Finding the median: odd n versus even n
Sort the data from smallest to largest first. If the number of values, n, is odd, the single middle value is the median. If n is even, there are two middle values, and the median is their average.
In the example (7 values, odd): sorted, 2, 4, 5, 5, 7, 9, 10. The middle (4th) value is 5, so the median is 5.
Why the standard deviation squares first, then takes a square root
Simply averaging how far each value sits from the mean (x − x̄) always gives zero, because the positive distances of values above the mean cancel the negative distances of values below it. Squaring each distance fixes that (every squared number is positive), and taking the square root at the end brings the units back to normal, after averaging the squares.
In the example, the mean is 6. Each value's deviation and its square are shown in the table below; the average of those squares is 6.86, and its square root, σ, is 2.62.
Why the median resists an outlier
Calculating the mean needs the exact magnitude of every value, so one unusually large or small value pulls the mean toward itself. Calculating the median only needs the order of the values — where each one sits once they are sorted — not how large it is. An outlier sits at one end of the sorted list, but the position in the middle barely moves.
In the example (7 values): mean 6, median 5. Adding one outlier of 35 (now 8 values): the mean jumps to 9.625 — a huge change. But the median becomes just 6 — barely different, because it is still the average of the two middle values, and those two values barely changed.
That is exactly why real-world reports often use "median" instead of "mean" wherever extreme values are common, such as income or house prices: a country's "median income" is reported precisely because a handful of extremely wealthy people would drag the mean far above what a typical person earns.
Grouped data: summarizing a long list
With hundreds of individual values, writing each one down is impractical. Instead, the values are split into equal-width class intervals (say, 0–5, 5–10, 10–15, …) and only the count in each class — the frequency — is recorded. That summary is called grouped data.
Grouped data no longer records each exact value, only which class it fell into, so the formulas make one assumption: every value in a class is treated as sitting at that class's midpoint. That gives the mean formula its shape, while the median and mode use an interpolation formula instead, which assumes the values are spread evenly across the class.
x̄ = Σ(f × midpoint) / ΣfEvery value is assumed to sit at its class midpoint
Median = L + ((n/2 − cf)/f) × hL = lower limit of the median class, cf = cumulative frequency before it
Mode = L + ((f₁ − f₀)/(2f₁ − f₀ − f₂)) × hL = lower limit of the modal class, f₁ its frequency, f₀ and f₂ the neighbours
Checking the simulation's default grouped data
The default frequencies are 4, 8, 10, 6, 2 for classes 0–5, 5–10, 10–15, 15–20, 20–25, a total of n = 30. The mean is 11.5. The median class is 10–15 (the running total 4+8 = 12 first passes n/2 = 15 once 10 is added, reaching 22), giving a median of 11.5. That same class also has the highest frequency (10), so it is the modal class too, giving a mode of 11.67.
Which measure to use, and when
All three measures are correct, but they are not equally useful in every situation.
| Situation | Best measure | Why |
|---|---|---|
| Data is fairly evenly spread, with no extreme values | Mean | Uses every value, so it carries the most information |
| Some extreme values or outliers exist (income, wealth, house prices) | Median | Depends only on position, not magnitude, so outliers cannot pull it |
| Data is not numeric, but categorical (colour, shoe size, favourite team) | Mode | The only measure that still makes sense for non-numeric data |
| Exact values are unavailable, only class frequencies are | Grouped formulas | Interpolation gives an approximate median and mode |
Try these in the simulation
Predict the outcome before you run the simulation, then check.
- In raw-data mode, drag two dots onto the exact same value: the mode readout locks onto that value, and the dots visibly stack on the number line.
- Spread every dot to a different value, with no repeats at all: the mode readout reports that no value repeats.
- Turn the outlier on and watch the shaded band (mean ± 1 SD): it widens a lot once the outlier is added, because the spread has grown.
- In grouped mode, push one middle class's frequency to the maximum: that class becomes the modal class, and the median class often lands there too.
- In grouped mode, set the first and last class frequencies to zero: the remaining three classes still give a valid median and mode, using the exact same formulas.
Solved problems
Every solution sorts the data first, then states the formula, then substitutes — write it the same way in an exam.
Problem 1: the simulation's default raw data
Data: 2, 4, 5, 5, 7, 9, 10 (n = 7). Mean = (2+4+5+5+7+9+10)/7 = 6. The middle value in the sorted list is 5, so the median is 5. The value 5 occurs twice while every other value occurs once, so the mode is 5. The range is 10 − 2 = 8.
Problem 2: what an outlier changes
Adding 35 to problem 1's data (n = 8): the new mean is (42+35)/8 = 9.625, a huge jump from 6. But the new median is only 6, barely different from 5, because the two middle values hardly moved.
Problem 3: the simulation's default grouped data
Classes 0–5, 5–10, 10–15, 15–20, 20–25 with frequencies 4, 8, 10, 6, 2 (n = 30). Mean = Σ(f×midpoint)/n = 11.5. The median class is 10–15 (L=10, cf=12, f=10, h=5): Median = 10 + ((15−12)/10)×5 = 11.5. The modal class is also 10–15 (f₁=10, f₀=8, f₂=6): Mode = 10 + ((10−8)/(20−8−6))×5 = 11.67.
Problem 4: when there is no mode
Five students score 45, 50, 55, 60, 65 — every value is different. Mean = (45+50+55+60+65)/5 = 55. Median (the middle value) = 55. But no value repeats, so there is no mode here — that is a valid outcome, not an error.
Problem 5: when there are two modes
Seven shoe sizes: 6, 7, 7, 8, 9, 9, 10. Mean = 8, median (the 4th value) = 8. Both 7 and 9 occur twice while every other size occurs once, so there are two modes: 7 and 9.
Problem 6: a fresh grouped-data example
30 students' marks are grouped into classes 0–10, 10–20, 20–30, 30–40, 40–50 with frequencies 3, 7, 10, 6, 4 (n = 30). Mean = 25.33. The median class is 20–30 (L=20, cf=10, f=10, h=10): Median = 20 + ((15−10)/10)×10 = 25. The modal class is also 20–30 (f₁=10, f₀=7, f₂=6): Mode = 20 + ((10−7)/(20−7−6))×10 = 24.29.
Problem 7: the same mean, different spread
Group A: 5, 5, 5, 5, 5. Mean = 5, standard deviation = 0, since no value differs from the mean at all. Group B: 1, 3, 5, 7, 9. The mean is also 5 — identical! But the standard deviation is 2.828, because the values are spread widely around that same mean. Judging the two groups by their mean alone would miss this completely.
Quick reference: the standard deviation, step by step
For problem 1's data, here is every value's deviation from the mean and its square. Averaging the squares and taking the square root gives σ.
| Value, x | x − mean | (x − mean)² |
|---|---|---|
| 2 | -4 | 16 |
| 4 | -2 | 4 |
| 5 | -1 | 1 |
| 5 | -1 | 1 |
| 7 | 1 | 1 |
| 9 | 3 | 9 |
| 10 | 4 | 16 |
Mistakes almost everyone makes
Avoiding these keeps exam marks from slipping away on mean, median and mode questions.
- Forgetting to sort the data before finding the median — the definition of median depends entirely on the sorted order.
- Taking only one middle value when n is even, instead of averaging the two middle values.
- Thinking the mode is the largest value — the mode is the most frequent value, not the biggest one.
- Using n instead of n/2 in the grouped median formula — the formula needs half the total frequency.
- Averaging the deviations directly in a standard deviation calculation, without squaring first — that always gives zero, because positive and negative deviations cancel.
- Calling the mean "wrong" just because one outlier changed it a lot — the mean is not wrong, only sensitive to outliers, which is exactly why the median is more trustworthy for that kind of data.
Mean, median and mode in real life
These measures show up in newspapers and reports well outside the exam hall.
- A country reports its "median income", not its "average (mean) income", because a small number of extremely wealthy people would drag the mean far above what a typical person earns.
- A shoe shop tracks its best-selling size (the mode) so it can keep more stock of that size on the shelf.
- Exam results are analysed using both the class mean and the class median; a big gap between them signals that some students scored unusually high or low.
- A weather forecast reporting a month's average temperature also needs its spread, since two months can share the same mean temperature while one stays steady and the other swings wildly.
- Factories aim for a low standard deviation in manufactured part sizes, since a small standard deviation means most parts come out close to the target size.
Exam tips
Mean, median and mode questions appear on almost every statistics syllabus. Two habits earn marks reliably: always sort the data before finding the median, and always check whether n is odd or even before picking the median rule.
A worked exam-style question
Question: Ten farmers in a village own 2, 4, 5, 5, 7, 9, 10 acres of land, and one large landowner owns 35 acres. (a) Define median. (b) Find the mean land held by the first seven farmers. (c) Find the mean and median for all eight landowners. (d) Is it fair to say that the large landowner makes the mean misleading, and the median more trustworthy? Justify your answer.
(c): Mean = 9.625, median = 6. (d): the mean jumped hugely from 6 to 9.625, while the median moved only slightly from 5 to 6, so the statement is justified.
Revision: one-screen summary
The night before an exam, this list and the tables above are enough to refresh everything.
- Mean x̄ = (Σx)/n — uses every value, sensitive to outliers.
- Median = the middle value of sorted data — depends on position, resistant to outliers.
- Mode = the most frequent value — none if nothing repeats, more than one if there is a tie.
- Range = highest − lowest; standard deviation σ = √(Σ(x−x̄)²/n).
- Grouped data finds the mean from midpoints, and the median and mode from an interpolation formula.
- When outliers are present, the median is the more trustworthy representative value.
Frequently asked questions
What's the difference between mean, median and mode?
The mean is the sum of every value divided by how many there are; the median is the middle value of the sorted data; the mode is the value that occurs most often. All three summarize where data is centred, but they are calculated differently.
How do I find the median?
Sort the data from smallest to largest. If n is odd, the middle ((n+1)/2)th value is the median. If n is even, average the two middle values. In the example, the middle of 7 sorted values is 5, so the median is 5.
What is the formula for the median and mode of grouped data?
Median = L + ((n/2 − cf)/f) × h, where L is the lower limit of the median class, cf is the cumulative frequency before it, f is its frequency, and h is the class width. Mode = L + ((f₁−f₀)/(2f₁−f₀−f₂)) × h, where f₁ is the modal class frequency and f₀, f₂ are the neighbouring classes' frequencies.
Should I use the mean or the median when there is an outlier?
The median is the safer choice when an outlier is present, because it depends only on position, not magnitude. In the example, adding an outlier of 35 jumps the mean from 6 to 9.625, while the median barely changes.
Can a dataset have no mode?
Yes. If every value in the data is different, with none repeated, there is no mode. That is a normal, valid outcome, not a mistake.
Can a dataset have more than one mode?
Yes. If two or more values are tied for the highest frequency, all of them are modes. Such data is called bimodal (two modes) or multimodal (more than two).
What does the standard deviation tell you?
The standard deviation measures how spread out the data is around the mean. A small standard deviation means the values cluster close to the mean; a large one means they are spread widely, even if two datasets share the exact same mean.
Why isn't the mean always a reliable summary?
Because the mean is calculated from the exact magnitude of every value, one unusually large or small value (an outlier) can pull it a long way from where most of the data actually sits — like one very wealthy person raising a group's average income far above what is typical.
What's the difference between range and standard deviation?
The range is just the highest value minus the lowest — it depends on only two values. The standard deviation considers how far every value sits from the mean, making it a more reliable measure of spread.
Why does the grouped-data mean formula use class midpoints?
Grouped data records only which class each value fell into, not the exact value. Assuming every value sits at its class midpoint gives a reasonable approximate mean without needing the original individual values.
Keep studying this topic
The animation made the idea click; now turn it into marks. Syllabus, suggestions, textbooks and admission-test guides are below.
Textbook
Class 9-10 Mathematics textbook
SSC
SSC Mathematics: syllabus and preparation
SSC
SSC Higher Mathematics: syllabus and preparation
HSC
HSC Higher Mathematics: syllabus and preparation
Textbook
Class 9-10 Higher Mathematics textbook
Admission
Engineering admission test preparation
Admission
Jahangirnagar University mathematical and physical sciences unit
English
Paragraph: Artificial Intelligence
Bangla
রচনা: কৃত্রিম বুদ্ধিমত্তা (in Bangla)
SSC
SSC suggestions
HSC
HSC suggestions
Admission
University admission guide
SSC
SSC syllabus
HSC
HSC syllabus
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.
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
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
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






















