Omni Calculator logo

Parity Calculator

Created by Davide Borchia
Reviewed by Anna Szczepanek, PhD
Last updated: Jan 18, 2024


Parity is not as straightforward as it sounds: our parity calculator will explain this concept in the many fields it appears! Keep reading this oddly specific article to find things you didn't even know you wanted to discover. Here you will learn:

  • What is parity?
  • The types of parity;
  • Parity across number bases;
  • How to calculate parity: binary and decimal cases;
  • Parity in computer science;
  • How to calculate the parity of a message.

What is parity? A mathematical definition

Parity in mathematics is both a trivial and a surprisingly complex concept. There are only two types of parity, and you know them:

  • Even parity; and
  • Odd parity.

By definition, an even number is divisible by two, while this doesn't apply to odd numbers. How do we write this in mathematical language? It... depends!

But why do we care about parity? Interesting question. In your daily life, the applications of this concept are never too technical. With an even number of people, you can create pairs without leaving anyone behind, and odd numbers of sets prevent matches from ending in a draw.

For mathematicians, the story is slightly different. After disregarding parity for some years during their studies, they return to this seemingly simple concept in highly theoretical applications where the evenness or oddity (we love this word!) of a number has significant consequences, for example, in game theory or group theory. We don't need to give examples here. Or maybe just one!

A 3×33\times3 Rubik's cube has always a straightforward solution. This is not true for a 4×44 \times4 Rubik's cube, where you can find yourself at the very last stages of the solution with a particular single pair of tiles out of place. This issue is due to the even length of the sides!

How to calculate parity: binary and decimal parity

To calculate parity, look at your number's ending. But what to look for depends on the base in which you are writing your number.

Parity in base 1010

To calculate parity in base 1010, we check if the last digit is divisible by 22. The corresponding mathematical operation is the modulo operation. If you want to learn more, visit our modulo calculator.

Take your number nn, and calculate:

n mod 2n\ \mathrm{mod}\ 2

And check the result:

n mod 2={0 if n is even1 if n is oddn\ \mathrm{mod}\ 2 =\begin{cases}0\ \mathrm{if\ }n\mathrm{\ is\ even}\\1\ \mathrm{if\ }n\mathrm{\ is\ odd}\end{cases}

To determine the parity of a decimal number (a number in base ten), you can also remember the possible last digits that make it even:

2,4,6,8, and 02,4,6,8,\ \mathrm{and}\ 0

We are mostly interested in another base: 22. Let's discover how to calculate parity in binary numbers.

How to calculate binary parity

To calculate binary parity, you really just need to glance at your number. First, convert your number in base 22. You can easily do it at Omni's binary converter. Then look at the last digit:

  • If the last digit is 00 the number is even.
  • If the last digit is 11 the number is odd.

🔎 Parity is conserved with respect to change in number base: an even number in base 1010 remains even in base 22.

This rule is easy to prove by looking at how numbers behave in base 22. Starting from 00, we find:

1,10,11,100,101,110,111,...1, 10, 11, 100, 101, 110, 111,...

As you can see, the last digit alternates between 11 and 00.

Now, let's take a look at parity in computer science.

Parity in computer science

In computer science, parity has a slightly different meaning than in mathematics. Since computers think in binary, we don't have to think about division by 22 or other operations. Instead, the concept of parity in your laptop has something to do with the number of ones in a binary string.

  • We say that a binary number has even parity if the number of 11 it contains is even.
  • A binary number has odd parity if the number of 11 it contains is odd.

Notice two things out of this definition:

  • We don't say that the number is even or odd, but that it has even parity or odd parity. The number itself can be odd and have even parity; these are two separate concepts!
  • The number of 00s doesn't affect the overall parity of the number!

There is no mathematical rule to calculate the parity of a number; we need to rely on a tally of the 11s done the old way — counting — or performed by a computer.

Why do we need parity? We use this concept as a rudimentary procedure to check the correctness of a message. How? Check our other parity calculators to learn the most elementary error correction routine! Check Omni's parity tools:

FAQ

How do I check if a number is even or odd?

To check if a number n is even or odd, follow these easy steps:

  1. Take your number and divide it by 2.
  2. Look at the result:
    • If the result is an integer number, the original number is even.
    • If the result has a decimal part, the original number is odd.
  3. Alternatively, look at the last digit in your number:
    • If it is 0,2,4,6,8, your number is even.
    • If it is 1,3,5,7,9, your number is odd.

Is zero even or odd?

Zero is an even number because it can be divided by two with no remainder, so it satisfies the definition of an even number. The fact that zero is divisible by every other (non-zero) number as well has no importance here.

How do I calculate the parity of a binary message?

To calculate the parity of a binary message:

  1. Make sure your message is in base 2: only 0s and 1s are allowed!
  2. Count the occurrences of 1 in your message:
    • If the number of 1s is even, the message has even parity.
    • If the number of 1s is odd, the message has odd parity.

Remember that an odd binary number can have even parity and vice-versa!

What is the parity of the message 11001001?

The message 11001001 has even parity. To compute the parity of this message, we counted the number of ones: this digit occurs four times in the message.

Notice that the message has the least significant bit (the rightmost bit) equal to 1. So this is an odd number! Parities in the mathematical sense and in the informatical sense don't always coincide.

Davide Borchia
Type of parity:
Mathematics
Number base
10
Number
Check out 32 similar tech and electronics calculators 💻
3D printing costAmdahl's lawBattery capacity… 29 more
People also viewed…

Chilled drink

With the chilled drink calculator, you can quickly check how long you need to keep your drink in the fridge or another cold place to have it at its optimal temperature. You can follow how the temperature changes with time with our interactive graph.

Duty cycle

Learn how to calculate the duty cycle of a periodic system with Omni's duty cycle calculator: insert what you know, and we'll do the math!

Impedance matching

Use the impedance matching calculator to find the appropriate values of the electronic components in the L-match, Pi-match, or T-match topology.

Significant figures

The significant figures calculator performs operations on sig figs and shows you a step-by-step solution!
Copyright by Omni Calculator sp. z o.o.
Privacy, Cookies & Terms of Service