BrightChamps Logo
Login

Summarize this article:

Live Math Learners Count Icon1591 Learners

Last updated on November 20, 2025

Z Test

Professor Greenline Explaining Math Concepts

Most of us have wondered how mathematicians compare different datasets. Well, they use different methods and the z-test is one such method. The z-test can be used to assess the hypotheses concerning population proportions or averages. The z-test is usually applied to one sample, two samples, or proportions. It also has many real-life applications. For example, it can be used to compare the average weight of students belonging to one school to the weight of students from another school. This is done to check if there is any major variation between them. Let’s learn more about these tests.

Professor Greenline from BrightChamps

What is a Z Test?

  • A z-test is a statistical method used to test whether the averages of two groups differ, provided the data follow a normal distribution. 
     
  • To perform a z-test, first set up the null and alternative hypotheses. Next, calculate the value of the z-test statistic. The decision about whether to accept or reject the null hypothesis is made by comparing the test statistic to the z critical value.
     
  • A z-test is performed on a population whose data follow a normal distribution, and the sample size is at least 30 with independent observations. This test is used to determine whether the means of two populations are equal when the population variances are known. 
     
  • The null hypothesis can be rejected if the calculated z-test statistic exceeds the critical value, indicating a meaningful difference between the population means.


Key Takeaways from Z-Tests

Z tests are utilized in comparing one sample to another or with a population in various sectors. Let’s look at a few key takeaways:

 

  • Z- tests are applied when the sample sizes are more than 30.
     
  • These tests are used only when the standard deviation is known, otherwise we prefer t-tests.
     
  • Using these, we compare averages and proportions in data sets.
     
  • To draw conclusions from data, we assess assumptions using the null hypothesis (H0) and the alternative hypothesis (H1).
Professor Greenline from BrightChamps

Types of Z Test

Z-tests come in various types. We will now explore each of them:

 

One-sample z-test: We use the one-sample test when a single sample differs extensively from a known population mean. To use this test, the population standard deviation should be known, and the sample size must be more than 30.

Two-sample z-test: This test compares the means of two independent samples.


Let μ1 and μ2 be the population means; X1 and X2 are sample mean.


The null hypothesis of the test could be:


H0: μ1 – μ2 = 0


H1: μ1 – μ2 ≠ 0

 

We calculate the z-test score using the formula:


\(Z = \frac{(\bar{X}_1 - \bar{X}_2) - (\mu_1 - \mu_2)} {\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}}\)

 

Here:


X = sample mean


σ1 and σ2 = standard deviation


n1 and n2 = population sample sizes for p1 and p2 

Professor Greenline from BrightChamps

Z Test Formula

Z Test Formula

The z-test formula compares the z-statistic with the z-critical value to determine if there is a difference between the means of two populations. In hypothesis testing, the z-critical value separates the distribution into acceptance and rejection regions. If the test statistic falls in the rejection region, the null hypothesis is rejected; otherwise, it is not rejected.

The formulas used to set up hypothesis tests for both one-sample and two-sample z tests are given as:



One-Sample Z Test

A one-sample z test is used to determine whether the sample mean differs significantly from the population mean when the population standard deviation is known.

The formula for calculating the z-test statistic is:

\(z = \frac{\overline{x} - \mu}{\frac{\sigma}{\sqrt{n}}}\)

Where x is the sample mean, μ is the population mean, σ is the population standard deviation, and n is the sample size.

The algorithm to set a one-sample z test based on the z test statistic can be given as:

Left-Tailed Test:

Null Hypothesis: \(H_0 : μ =μ_0\)
Alternate Hypothesis: \(H_1:μ<μ_0\)
The decision criterion is to reject the null hypothesis if the z statistic is less than the z critical value.

Right-Tailed Test:

Null Hypothesis: \(H_0: μ = μ_0\)
Alternate Hypothesis: \(H_1: μ > μ_0\)
The decision criterion is to reject the null hypothesis if the z statistic is greater than the z critical value.

Two-Tailed Test:

Null Hypothesis: H0 : μ = μ0
Alternate Hypothesis: \(H_1 : μ ≠ μ_0\)
The decision criterion is to reject the null hypothesis if the z statistic is greater than the z critical value.

Two-Sample Z Test

A two-sample z test is a statistical method used to determine whether there is a significant difference between the means of two independent samples. It checks whether the averages of two groups differ, assuming the population variances are known and the samples are drawn from normally distributed populations.

The z test statistic formula is expressed as:

\(z = \frac{\left( \bar{x}_1 - \bar{x}_2 \right) - \left( \mu_1 - \mu_2 \right)} {\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}} \)

Where \(\bar{x}_1, μ_1, \sigma_1^2\) are the sample mean, population mean and population variance respectively for the first sample. Similarly, \(\bar{x}_2, μ_2, \sigma_2^2\) are the sample mean, population mean, and population variance of the second sample.

The two-sample z test is similar to the one-sample test but is used to compare the means of two different samples. For instance, the null hypothesis can be stated as, \(H_0: μ_1 = μ_2\), meaning the means of the two populations are equal.

Explore Our Programs

Grade 1
arrow-left
arrow-right
Professor Greenline from BrightChamps

Z Test for Proportions

Z tests can be used in comparing proportions between a sample and a population, or two samples. For example: Determining whether the proportion of girls in a school differs significantly from the percentage worldwide.

Z Test Proportions:

Z tests can be used to compare proportions between a sample and a population, or between two samples. For example, determining whether the proportion of girls in a school differs significantly from the percentage worldwide.

One Proportion Z Test:
A one-proportion z test is applied when comparing an observed proportion with a theoretical proportion across two groups.
The z test statistic for this test is calculated using the following formula:

\(z = \frac{p - p_0}{\sqrt{\frac{p_0(1 - p_0)}{n}}} \)

where,
p is the observed proportion, 
\(P_0\) is the theoretical (or hypothesized) proportion, and 
N is the sample size.

The null hypothesis states that the two proportions are equal, while the alternative hypothesis states that they differ.

Two Proportion Z Test:

A two-proportion z-test compares two proportions to determine whether they differ significantly.

The formula for the z test statistic is:

\(z = \frac{p_1 - p_2 - 0}{\sqrt{p(1 - p)\left( \frac{1}{n_1} + \frac{1}{n_2} \right)}} \)

Where, \(p = \frac{x_1 + x_2}{n_1 + n_2} \)

Where \(P_1\) and \(P_2\) are the sample proportions for the two groups, \(n_1\) and \(n_2\) are the sample sizes, and P is the pooled proportion calculated from both groups combined.

Professor Greenline from BrightChamps

How to Calculate Z Test Statistic?

How to Calculate Z Test Statistic?

Interpreting the problem correctly is the most crucial step in calculating the z-test statistic. It is essential to identify the appropriate tailed test and determine which category the z statistic falls into before proceeding.

The steps to calculate the z-test statistic are given as;

Step 1: Identify the type of test. For example, if comparing the means of two populations in one direction, a right-tailed two-sample z test is used.

Step 2: Set up the hypotheses:

\(H_0: \mu_1 = \mu_2, H_1: \mu_1 > \mu_2.\)

Step 3: Using the z table, find the critical value for the given alpha level, e.g., 1.645.

Step 4: Calculate the z-test statistic with the formula:

\(z = \frac{ \left( \bar{x}_1 - \bar{x}_2 \right) - \left( \mu_1 - \mu_2 \right) }{ \sqrt{ \frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2} } } \)

Substitute the values:

\(X_1 =22.1\), \(\sigma _1 =4.8\)\(n_1 =60\)\(X_2 = 18.8\)\(\sigma _2 =8.1\)\(n_2 =40\) and \(\mu_1-\mu_2 = 0.\) thus, \(z = 2.32.\)

The calculated z statistic is 2.32.

Step 5: Compare the calculated z statistic with the critical value. Since 2.32 > 1.645, reject the null hypothesis.

Step 6: Conclude that there is sufficient evidence to support the claim that the students' scores in the first class are higher.

Professor Greenline from BrightChamps

Z-Test vs T-Test

The comparison between z-test and t-test is given as;
 

Z Test T Test
A z-test is a statistical method used to determine if the means of two data sets differ significantly when the population variance is known. A T-Test is used to determine if there is a difference between the means of two data sets when the population variance is unknown.
The sample size of a z-test is greater than or equal to 30. The sample size is less than 30.
The data also follows a normal distribution. The data follows a Student’s t-distribution.
The one-sample z-test statistic is given by \(z = \frac{\bar{x} - \mu}{\sigma / \sqrt{n}} \) The t-test statistic is given as \(t = \frac{\bar{x} - \mu}{s / \sqrt{n}} \) where s stands for the sample standard deviation.
Professor Greenline from BrightChamps

Tips and Tricks to Master Z Test

Learning about the Z-test helps students compare datasets in real-world situations. The tips and tricks mentioned below will help us understand the concept easily:
 

  • The z-tests are used only when the sample size is greater than 30.
     
  • Correct formulas should be used for z-tests and t-tests.
     
  • Use the decision rule to make quick decisions: 
     
  • If \(∣Z∣ < Z_{critical},\) reject H0​ (significant difference).
     
  • If \(∣Z∣ < Z_{critical},\) fail to reject H0​ (no significant difference).
     
  • There is a trick to determine the normality: If \(n < 30\), check for normality before doing a z-test.
Professor Greenline from BrightChamps

Real-Life Applications of Z Test

Z tests are used in various fields in comparing averages. Let’s explore a few of them:
 

  • Z-tests can be used to compare the average scores of students in a school with those in another school to analyze if they are significantly different.
     
  • Companies apply z-tests to analyze and compare the effectiveness of two advertisements.
     
  • Researchers can use these tests to determine which drug or medicine yields a better result.
     
  • These are widely used by teachers to check the effectiveness of different teaching methods.
     
  • Banks can make use of these tests in analyzing the default loan rates of two specific loans.
     
  • In medical research, Z-tests are used to compare the effects of a treatment between two groups.
Max Pointing Out Common Math Mistakes

Common Mistakes and How to Avoid Them in Z-Test

We now know the importance of perfectly executed Z-tests. However, students can make some errors in calculations, which can lead to incorrect results. We will now look at a few common mistakes to watch out for and the ways to avoid them:

Mistake 1

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Applying for Small Samples (n < 30)

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

Always ensure that you apply a t-test if the sample size is more than 30 and a standard deviation is not given.

Keep in mind that Z-tests are for samples of more than 30.

Mistake 2

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Not Defining Hypothesis Clearly

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

To avoid bias, it is important to begin with an appropriate definition:


H0: Since H0 is a null hypothesis, its effect will be nil.


H1: Alternative hypothesis for which the effect exists.

Mistake 3

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Relying on Normality

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

To avoid this type of error, we must check the normality of data before performing the z-test.

For that, use histograms or Q-Q plots.

Mistake 4

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Mistakenly applying z-test for dependent samples

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

Use z-tests only for independent samples. If the groups are of the same nature, always use t-tests.

Mistake 5

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Not considering populations standard deviation

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

To avoid inaccurate results, use t-tests when the standard deviation (σ) is unknown.

arrow-left
arrow-right
Max from BrightChamps Saying "Hey"
Hey!

Solved Examples of Z Test

Ray, the Character from BrightChamps Explaining Math Concepts
Max, the Girl Character from BrightChamps

Problem 1

A researcher wants to compare the average scores of two groups of students. Group A (20 students) has an average test score of 60 with a standard deviation of 5, while Group B (25 students) has an average score of 65 with a standard deviation of 10. Test at a 1.5 significance level if there is a significant difference in the means.

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"
Okay, lets begin

We have insufficient evidence at the 1.5% level of significance to determine the variation of the scores.

Explanation

In the problem, we have that:


Group A:


n1 = 20


X1 = 60


S1 = 5

 

Group B is given as:


n= 25


X2 = 65


S2 = 10


The significance level is given as 1.5 %: \(𝛂 = 0.015\)

 

Now, state the hypothesis:


H0: μ1 = μ


H1: μ1 ≠ μ

 

Using the formula:


\(Z = \frac{(X1 − X2)} {\sqrt{σ n_1^2 + σ n_2^2 }}\)

 

\(Z = \frac{60-65}{\sqrt{\frac{5^2}{20} + \frac{10^2}{25}}}\)

 

\(= \frac{-5}{\sqrt{\frac{25}{20} + \frac{100}{25}}}\)

 

\(= \frac{-5}{\sqrt{1.25 + 4}}\)

 

\(= \frac{-5}{\sqrt{5.25}}\)

 

\(= \frac{-5}{2.291287847\ldots}\)

 

\(Z \approx -2.182178902 \approx -2.18 \quad(\text{rounded to 2 d.p.})\)


We calculate the critical z-value for 𝛂 = 0.015 as ±2.42.


Since −2.18 > −2.42, we could not reject the null hypothesis at the 1.5% significance level. The evidence is insufficient to conclude a significant difference in test scores.

Max from BrightChamps Praising Clear Math Explanations
Well explained 👍
Max, the Girl Character from BrightChamps

Problem 2

A fruit seller says that the apples in his shop weigh 200 grams on average. You and your friends pick 35 apples and find that their average weight is 150 grams. You also know that apples usually have a weight variation of 15 grams. Should we believe the fruit seller’s claim?

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"
Okay, lets begin

The possibility of getting a sample with an average weight of 150 grams if the true mean was 200 grams is exceedingly low. This shows the fruit seller’s assertion was low.

Explanation

Given that,


Claimed average weight = 200 grams


Sample average weight = 150 grams


Standard deviation = 15 grams


Sample size = 35 apples

 

Here, we use the z-test formula:


\(Z = \frac{\bar{x} - \mu}{\sigma / \sqrt{n}}\)

 

\(Z = \frac{150 - 200}{15 / \sqrt{35}}\)


= −50 / (15 / 5.92) 


\(= \frac{-50}{2.53}\)  = −19.76

 

Z = −19.76

 

Since Z is below any significance threshold, we should reject the null hypothesis and conclude that the fruit seller’s claim is likely false. 

Max from BrightChamps Praising Clear Math Explanations
Well explained 👍
Max, the Girl Character from BrightChamps

Problem 3

A company says their new running shoes help people run 5 minutes faster than usual. Your school tests these shoes on 35 students and finds that, on average, students run 5.5 minutes faster with a variation of 4.5 minutes. Can we believe the company?

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"
Okay, lets begin

As the value does not cross the critical value, we cannot reject the null hypothesis. Therefore, we cannot deny the company’s claim.

Explanation

We have that:


n = 35


Claimed change = 5 minutes


Sample average change = 5.5 minutes


Standard deviation = 4.5 minutes


Step 1 is to formulate the hypotheses:


Null hypothesis: The company’s claim is true.


H0: μ = 5


Alternative hypothesis: The true mean could be different from 5 minutes.


H𝛼: μ ≠ 5


Using Z-test:

 

\(Z = \frac{\bar{x} - \mu}{\sigma / \sqrt{n}}\)


\(Z = \frac{5.5 - 5}{\frac{4.5}{\sqrt{35}}}\)

 

\(= \frac{0.5}{\frac{4.5}{5.916}}\)

 

\(= \frac{0.5}{0.76}\)

 

= 0.66


To find the critical value:


For a two-tailed Z-test with a significance threshold of 0.05, the crucial value is ± 1.96.

 

Now, we make the decision; the calculated value is \(0.66 < 1.96\)


As the value does not cross the critical value, we cannot reject the null hypothesis. Therefore, we cannot deny the company’s claim.

Max from BrightChamps Praising Clear Math Explanations
Well explained 👍
Ray Thinking Deeply About Math Problems

FAQs on Z Test

1.What do you mean by z-test?

Z-tests are statistical tests that we use to determine if two sample means are largely different. These tests are used when the sample size is more than 30.
 

Math FAQ Answers Dropdown Arrow

2.Write the different kinds of Z-tests.

One-sample Z-test, two-sample Z- test, and Z-test for proportions.
 

Math FAQ Answers Dropdown Arrow

3.When should we use a Z-test instead of a T-test?

When the sample size is larger than 30 and the population variance is known, we use Z-test.

 

Give the formula for a Z-test,


z = (X1 − X2) / √σ 2n+ σ 2n

 

Here:


X = sample mean


σ1 and σ2 = standard deviation


n1 and n2 = population sample sizes for p1 and p

Math FAQ Answers Dropdown Arrow

4.Cite one real-life example of a z-test.

Z-tests are applied to compare the heights of students from two different schools.

Math FAQ Answers Dropdown Arrow
Math Teacher Background Image
Math Teacher Image

Jaipreet Kour Wazir

About the Author

Jaipreet Kour Wazir is a data wizard with over 5 years of expertise in simplifying complex data concepts. From crunching numbers to crafting insightful visualizations, she turns raw data into compelling stories. Her journey from analytics to education ref

Max, the Girl Character from BrightChamps

Fun Fact

: She compares datasets to puzzle games—the more you play with them, the clearer the picture becomes!

INDONESIA - Axa Tower 45th floor, JL prof. Dr Satrio Kav. 18, Kel. Karet Kuningan, Kec. Setiabudi, Kota Adm. Jakarta Selatan, Prov. DKI Jakarta
INDIA - H.No. 8-2-699/1, SyNo. 346, Rd No. 12, Banjara Hills, Hyderabad, Telangana - 500034
SINGAPORE - 60 Paya Lebar Road #05-16, Paya Lebar Square, Singapore (409051)
USA - 251, Little Falls Drive, Wilmington, Delaware 19808
VIETNAM (Office 1) - Hung Vuong Building, 670 Ba Thang Hai, ward 14, district 10, Ho Chi Minh City
VIETNAM (Office 2) - 143 Nguyễn Thị Thập, Khu đô thị Him Lam, Quận 7, Thành phố Hồ Chí Minh 700000, Vietnam
UAE - BrightChamps, 8W building 5th Floor, DAFZ, Dubai, United Arab Emirates
UK - Ground floor, Redwood House, Brotherswood Court, Almondsbury Business Park, Bristol, BS32 4QW, United Kingdom