NDA Maths · Binary Numbers

Binary ↔ Decimal Conversion

Base 2 writes every number with just the digits 0 and 1, where each place is worth a power of 2. Converting between binary and decimal is the single skill that unlocks the whole chapter — almost every PYQ starts with it.

Why this matters

This subtopic is the chapter's foundation. The NDA almost never asks you to do clever things IN binary — it asks you to convert, do ordinary decimal arithmetic, and (sometimes) convert back. Three direct PYQs live here, but the conversion skill is used in every other question in the chapter. Get decimal ↔ binary fluent first and the rest becomes easy.

Concept 1 of 3

What Base 2 Means — Place Values Are Powers of 2

Intuition

In ordinary decimal (base 10) each place is worth a power of 10: ones, tens, hundreds. Binary (base 2) is the same idea with only two digits, 0 and 1, and each place worth a power of 2: ones, twos, fours, eights. A binary digit is called a bit, and it can only be 0 or 1 — there is no digit '2' in base 2.

Definition

A binary number is written using only the bits 0 and 1, in base 2. Reading from the right, the place values are

20=1,  21=2,  22=4,  23=8,  24=16,  25=32,  2^0 = 1,\ \ 2^1 = 2,\ \ 2^2 = 4,\ \ 2^3 = 8,\ \ 2^4 = 16,\ \ 2^5 = 32,\ \ \ldots
A binary string (bnbn1b1b0)2(b_n b_{n-1}\ldots b_1 b_0)_2 means the weighted sum
(bnbn1b1b0)2=bn2n+bn12n1++b121+b020,(b_n b_{n-1}\ldots b_1 b_0)_2 = b_n\,2^n + b_{n-1}\,2^{n-1} + \cdots + b_1\,2^1 + b_0\,2^0,
where each bit bi{0,1}b_i \in \{0, 1\}. The little subscript 22 is what marks a number as binary; with no subscript a number is assumed decimal (base 10).

  • The rightmost bit (b0b_0, worth 20=12^0 = 1) is the least significant bit.
  • The leftmost bit is the most significant bit.
  • A handy fact: a string of nn ones, (111n)2(\underbrace{11\ldots1}_{n})_2, equals 2n12^n - 1 (e.g. (11111)2=251=31(11111)_2 = 2^5 - 1 = 31).

Powers of 2 (place values)

2n29282726252423222120value5122561286432168421\begin{array}{c|ccccccccc} 2^n & 2^9 & 2^8 & 2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0 \\ \hline \text{value} & 512 & 256 & 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \end{array}

Worked example

What place values do the bits of (1011)2(1011)_2 carry, and what number is it?
  1. From the right the place values are 20=1, 21=2, 22=4, 23=82^0 = 1,\ 2^1 = 2,\ 2^2 = 4,\ 2^3 = 8.
  2. The bits of (1011)2(1011)_2 from the right are 1,1,0,11, 1, 0, 1.
  3. Add the place values where the bit is 11: 8+0+2+1=118 + 0 + 2 + 1 = 11.
Answer:(1011)2(1011)_2 carries places 8,4,2,18, 4, 2, 1 and equals 111011_{10}.
Practice this concept4 quick reps

Practice — Level 1 (4 reps)

Quick reps to lock in the method. Try each, then check.

  1. 1.
    What is the place value of the leftmost bit of (100000)2(100000)_2?
  2. 2.
    How many bits are 1 in (1101)2(1101)_2, and which is the least significant bit?
  3. 3.
    Without converting, what is (1111)2(1111)_2 using the all-ones shortcut?
  4. 4.
    Is (1021)2(1021)_2 a valid binary number?

Place values grow leftward, from 2⁰ on the RIGHT

The rightmost bit is the 20=12^0 = 1 place, not the 212^1 place. Counting the powers from the left, or starting at 212^1, shifts every weight and is the most common conversion slip.

Concept 2 of 3

Converting Binary to Decimal

Intuition

To turn a binary number into decimal, just add up the place values wherever a bit is 1 — ignore every position holding a 0. That is the whole method; everything else in the chapter leans on it.

Definition

To convert (bnb1b0)2(b_n\ldots b_1 b_0)_2 to decimal, sum the powers of 2 at the positions where the bit is 1:

decimal=i:bi=12i.\text{decimal} = \sum_{i:\,b_i = 1} 2^i.

  • Line the bits up under their place values ,8,4,2,1\ldots, 8, 4, 2, 1 and add the ones that are switched on.
  • A symbolic binary like (cdc)2(cdc\ldots)_2 with a stated order such as c>dc > d is still binary: the only digits available are 0 and 1, so c=1c = 1 and d=0d = 0. Substitute and convert as usual.

Binary → decimal

(bnb1b0)2=i=0nbi2i(b_n\ldots b_1 b_0)_2 = \sum_{i=0}^{n} b_i\, 2^i

Worked example

Convert (110101)2(110101)_2 to decimal.
  1. Place values from the right: 32,16,8,4,2,132, 16, 8, 4, 2, 1.
  2. Bits from the right: 1,0,1,0,1,11, 0, 1, 0, 1, 1 — so the 1s sit at the 32,8,4,132, 8, 4, 1 places.
  3. Add them: 32+16+0+4+0+132 + 16 + 0 + 4 + 0 + 1... line them up: 1 ⁣ ⁣32+1 ⁣ ⁣16+0 ⁣ ⁣8+1 ⁣ ⁣4+0 ⁣ ⁣2+1 ⁣ ⁣1=32+16+4+1=531\!\cdot\!32 + 1\!\cdot\!16 + 0\!\cdot\!8 + 1\!\cdot\!4 + 0\!\cdot\!2 + 1\!\cdot\!1 = 32 + 16 + 4 + 1 = 53.
Answer:(110101)2=5310(110101)_2 = 53_{10}.
Practice this conceptself-check · 4 quick reps

Try it yourself

Convert (100110)2(100110)_2 to decimal.

Practice — Level 1 (4 reps)

Quick reps to lock in the method. Try each, then check.

  1. 1.
    Convert (1010)2(1010)_2 to decimal.
  2. 2.
    Convert (1101)2(1101)_2 to decimal.
  3. 3.
    Convert (111000)2(111000)_2 to decimal.
  4. 4.
    Convert (100001)2(100001)_2 to decimal.

From the bank · past-year question

Example 2Binary NumbersMODERATE
A binary number is represented by (cdccddcccddd)2(cdccddcccddd)_{2}, where c>dc > d. What is its decimal equivalent ?

[Q40 · Sep · 2019]

A 0 bit contributes nothing — don't add its place value

Only positions holding a 1 are summed. The fastest error is to add every place value you wrote down. Cross out the 0-bit places before adding so only the active weights remain.

Concept 3 of 3

Converting Decimal to Binary

Intuition

Going the other way, you peel off powers of 2 from largest to smallest, or — more mechanically — repeatedly divide by 2 and read the remainders bottom-up. Both give the same bits; pick whichever you find faster.

Definition

Two equivalent methods to convert a decimal number to binary:

  • Subtract powers of 2 (greedy): find the largest power of 2 not exceeding the number, put a 1 in that place, subtract it, and repeat with the remainder; every skipped place gets a 0.
  • Repeated division by 2: divide the number by 2, record the remainder (0 or 1), divide the quotient by 2 again, and so on until the quotient is 0. Read the remainders from bottom to top — that is the binary number.

Useful checkpoints: a value of the form 2n12^n - 1 is nn ones (so 31=251=(11111)231 = 2^5 - 1 = (11111)_2), and a single power 2n2^n is a 1 followed by nn zeros.

Repeated division by 2

N÷2(q1,r1)÷2(q2,r2)0;N=(rkr2r1)2N \xrightarrow{\div 2} (q_1, r_1) \xrightarrow{\div 2} (q_2, r_2) \to \cdots \to 0;\quad N = (\,r_k \ldots r_2\, r_1)_2

Worked example

Convert 451045_{10} to binary by repeated division.
  1. 45÷2=2245 \div 2 = 22 r 11; 22÷2=1122 \div 2 = 11 r 00; 11÷2=511 \div 2 = 5 r 11; 5÷2=25 \div 2 = 2 r 11; 2÷2=12 \div 2 = 1 r 00; 1÷2=01 \div 2 = 0 r 11.
  2. Read the remainders from bottom to top: 1,0,1,1,0,11, 0, 1, 1, 0, 1.
  3. Check by place value: 32+8+4+1=4532 + 8 + 4 + 1 = 45 ✓.
Answer:4510=(101101)245_{10} = (101101)_2.
Practice this conceptself-check · 4 quick reps

Try it yourself

Convert 261026_{10} to binary.

Practice — Level 1 (4 reps)

Quick reps to lock in the method. Try each, then check.

  1. 1.
    Convert 8108_{10} to binary.
  2. 2.
    Convert 151015_{10} to binary.
  3. 3.
    Convert 201020_{10} to binary.
  4. 4.
    Convert 631063_{10} to binary.

From the bank · past-year question

Example 3Binary NumbersEASY
The binary number expression of the decimal number 31 is

[Q17 · Apr · 2018]

Read the division remainders from the BOTTOM up

Repeated division produces the least significant bit first. Reading the remainders top-to-bottom reverses the number. The first remainder you write is the rightmost bit of the answer.

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Formulas (3)

  • What Base 2 Means — Place Values Are Powers of 2

    Powers of 2 (place values)

    2n29282726252423222120value5122561286432168421\begin{array}{c|ccccccccc} 2^n & 2^9 & 2^8 & 2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0 \\ \hline \text{value} & 512 & 256 & 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \end{array}
  • Converting Binary to Decimal

    Binary → decimal

    (bnb1b0)2=i=0nbi2i(b_n\ldots b_1 b_0)_2 = \sum_{i=0}^{n} b_i\, 2^i
  • Converting Decimal to Binary

    Repeated division by 2

    N÷2(q1,r1)÷2(q2,r2)0;N=(rkr2r1)2N \xrightarrow{\div 2} (q_1, r_1) \xrightarrow{\div 2} (q_2, r_2) \to \cdots \to 0;\quad N = (\,r_k \ldots r_2\, r_1)_2

Watch out for (3)

Mastery check — 1 interleaved questions

Try each one before clicking. Questions are interleaved across the concepts above, not grouped — interleaving sharpens transfer.

Example 1Binary NumbersEASY
The number (1101101+1011011)2(1101101 + 1011011)_2 can be written in decimal system as

[Q6 · Apr · 2020]

Drill every past-year question on this subtopic

3 questions from the bank — paginated, with cart and Word-export support.