Science and Coding Basics

Designing a Fair Experiment

Learn how independent, dependent and controlled variables work, why repeat trials matter, and how to plan a fair test using a simple plant-growth example.

On this page
  1. What makes a test fair
  2. The three kinds of variable
  3. A hypothetical example: light and plant growth
  4. Why you need a control group
  5. Repeat trials and sample size
  6. Measure carefully and consistently
  7. Plan before you start
  8. Reading the results with caution

What makes a test fair

An experiment is a test designed to answer a question about cause and effect. “Does this change make that outcome different?” A fair experiment is one where the only plausible explanation for any difference you see is the change you made, and not something else you accidentally let vary.

The core of fair testing is simple to say and takes care to carry out: change one thing, measure one thing, and keep everything else the same.

The three kinds of variable

A variable is anything that can change in your experiment. It helps to sort them into three groups.

  • Independent variable. The one thing you deliberately change. You choose its values.
  • Dependent variable. The thing you measure to see whether it responds. You do not control it; you observe it.
  • Controlled variables. Everything else that could affect the result, which you keep the same for every group.

A hypothetical example: light and plant growth

Suppose you wonder whether the amount of light affects how tall bean seedlings grow in two weeks. This is an invented example for illustration, with no real results claimed.

  • Independent variable: hours of light per day (say 6 hours versus 12 hours).
  • Dependent variable: seedling height after 14 days, measured in centimeters.
  • Controlled variables: type of seed, size of pot, kind of soil, amount of water, room temperature, and the day the seeds were planted.

If one group were in a warm room and the other in a cool one, you could not tell whether differences came from light or temperature. That mix-up is called a confounding variable. Spotting and removing them is most of the craft of experimental design.

Why you need a control group

A control group is a set that receives the standard conditions, or no treatment, so that you have something to compare against. In the plant example, the plants getting 12 hours of light would be compared with a group getting 6 hours. Without the comparison, a measurement alone says little. Knowing the plants reached 15 cm means nothing until you know what they would have reached otherwise.

In studies with people, extra safeguards such as random assignment to groups are often needed. For a home or classroom test, the main principle is still to treat the groups alike except for the one deliberate difference.

Repeat trials and sample size

One plant per group is not enough. Seedlings differ naturally: one seed may be weaker, one pot may drain better. If you use a single plant each, chance alone could produce a difference.

Using several plants per group, say five, and repeating the whole test if you can, helps in two ways:

  • Natural variation tends to average out.
  • You can see how much results vary within a group, which tells you how much a difference between groups should be trusted.

A tidy way to summarize is the mean, the sum of the measurements divided by how many there are. Suppose, purely as an invented example, the 12-hour group measured 14, 16, 15, 17 and 13 cm. The sum is 14 + 16 + 15 + 17 + 13 = 75, and 75 divided by 5 is 15 cm. If a 6-hour group had a mean of 11 cm, the gap is 4 cm. But if the individual values in each group overlapped a lot, that gap would be less convincing. The median, the middle value, is another common summary that copes better with one unusual result; both are among the familiar averages explained in any introductory statistics course.

There is no universal number of repeats that is always enough. More is generally better, and the right amount depends on how much natural variation there is.

Measure carefully and consistently

Decide in advance how you will measure, and do it the same way each time. Use the same ruler, measure from the same point, and record at the same time of day. Write results down at once in a table rather than relying on memory. Remember that every reading has some error, and that measurement uncertainty is part of every honest result.

Plan before you start

A short written plan prevents most mistakes:

  1. State the question and a testable prediction.
  2. List the independent, dependent and controlled variables.
  3. Describe the groups and how many items go in each.
  4. Describe exactly how and when you will measure.
  5. Decide how you will summarize results, for example with a table or simple charts.

Planning how you will read the data before collecting it also guards against a natural temptation to see what you hoped to see. A fair experiment is one step inside the wider cycle of question, prediction, test and conclusion that people call the scientific method.

Reading the results with caution

Even a well-run experiment gives limited answers.

  • A difference in your small test does not prove that the factor works the same way in other plants, places or seasons.
  • Showing that two things change together is not always evidence that one causes the other. Fair experiments are powerful precisely because you set the independent variable yourself, which makes cause easier to argue than in observational data. The point comes up in discussions of correlation and causation.
  • A surprising result is a reason to check for errors and repeat the test, not to stop trusting the method.

If the result is unclear, say so. “The groups differed by about 4 cm, but with only five plants each, we cannot be confident” is an honest and useful conclusion.

Common mistakes include changing two things at once, using one sample per group, measuring groups differently and stopping when results look the way you hoped.

A fair experiment does not guarantee a right answer. It guarantees only that the answer you get is easier to trust, and easier for someone else to check by repeating what you did.

The complete guide to science and coding basics

Computational Thinking: Solving Problems Like a Programmer
Read the guide

Keep exploring

Guides from other topics

All topics →