0% found this document useful (0 votes)
12 views12 pages

New Bpharm Notes Unit 1 Half

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views12 pages

New Bpharm Notes Unit 1 Half

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Unit I: Number Systems - Updated Notes with Explanations for B.

Pharm. Students

Introduction

Number systems are the backbone of how computers process data, which is
vital in pharmacy for managing drug inventories, barcodes, and electronic
records

1. Definition of Number System

A number system is a method of representing numbers using a specific set


of digits and a base (or radix). The base determines the number of digits
used and how each position in the number represents a power of the base.
For example, the decimal system (base-10) uses digits 0-9, while the binary
system (base-2) uses 0-1.

2. Types of Number Systems

2.1 Binary Number System

 Definition: The binary number system is a base-2 system that uses


only two digits, 0 and 1. It’s how computers store and process data, as
0 and 1 represent off and on states in circuits.

 Example: 1011
 = (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰)
 =8+0+2+1
 = 11 in decimal.

2.2 Decimal Number System

 Definition: The decimal number system is a base-10 system that uses


digits 0 to 9. It’s the standard system for human counting and is used
in pharmacy for dosages and labels.

 Example: 245
 = (2 × 10²) + (4 × 10¹) + (5 × 10⁰)
 = 200 + 40 + 5
 = 245.

2.3 Octal Number System

 Definition: The octal number system is a base-8 system that uses


digits 0 to 7. It’s used in computing to simplify binary numbers, as each
octal digit represents 3 binary bits (since 8 = 2³).
 Example: 127
 = (1 × 8²) + (2 × 8¹) + (7 × 8⁰)
 = 64 + 16 + 7
 = 87 in decimal.

2.4 Hexadecimal Number System

 Definition: The hexadecimal number system is a base-16 system that


uses digits 0-9 and letters A-F (A=10, B=11, ..., F=15). It’s used in
computing to represent binary numbers compactly, as each hex digit
represents 4 binary bits (since 16 = 2⁴).

 Example: 2AF
 = (2 × 16²) + (10 × 16¹) + (15 × 16⁰)
 = 512 + 160 + 15
 = 687 in decimal.

3. Conversions

3.1 Decimal to Binary

 Rule: Divide the decimal number by 2, record the remainder. Repeat until the quotient is
0. The binary number is the remainders read in reverse.
 Example: Convert 97 to binary
97 ÷ 2 = 48 remainder 1
48 ÷ 2 = 24 remainder 0
24 ÷ 2 = 12 remainder 0
12 ÷ 2 = 6 remainder 0
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
 Binary = 1100001

3.2 Decimal to Octal

 Rule: Divide the decimal number by 8, record the remainders in reverse.


 Example: Convert 97 to octal
97 ÷ 8 = 12 remainder 1
12 ÷ 8 = 1 remainder 4
1 ÷ 8 = 0 remainder 1
 Octal = 141

3.3 Decimal to Hexadecimal


 Rule: Divide the decimal number by 16, record the remainders in reverse. Use letters A-F
for 10-15.
 Example: Convert 97 to hexadecimal
97 ÷ 16 = 6 remainder 1
6 ÷ 16 = 0 remainder 6
 Hexadecimal = 61

3.4 Binary to Decimal

 Rule: Multiply each bit by 2 raised to its position index (starting from 0 on the right),
then add all results.
 Example: Convert 1100001 (binary) to decimal
(1 × 2⁶) + (1 × 2⁵) + (0 × 2⁴) + (0 × 2³) + (0 × 2²) + (0 × 2¹) + (1 × 2⁰)
= 64 + 32 + 0 + 0 + 0 + 0 + 1
= 97

3.5 Octal to Decimal

 Rule: Multiply each digit by 8 raised to its position index (starting from 0 on the right),
then add all results.
 Example: Convert 141 (octal) to decimal
(1 × 8²) + (4 × 8¹) + (1 × 8⁰)
= (1 × 64) + (4 × 8) + (1 × 1)
= 64 + 32 + 1
= 97

3.6 Hexadecimal to Decimal

 Rule: Multiply each digit by 16 raised to its position index (starting from 0 on the right),
then add all results.
 Example: Convert 61 (hex) to decimal
(6 × 16¹) + (1 × 16⁰)
= (6 × 16) + (1 × 1)
= 96 + 1
= 97

3.7 Octal to Binary

 Rule: Convert each octal digit to its 3-bit binary equivalent.


 Example: Convert 141 (octal) to binary
 1 (octal) = 001 (binary)
 4 (octal) = 100 (binary)
 1 (octal) = 001 (binary)
 Binary = 001 100 001 → Remove leading zeros → 1100001

3.8 Binary to Octal


 Rule: Group the binary digits into groups of 3 bits starting from right. Convert each
group to octal.
 Example: Convert 1100001 (binary) to octal
Group into 3 bits (from right): 1 100 001
Add leading zeros to leftmost group to make 3 bits: 001 100 001
 001 (binary) = 1 (octal)
 100 (binary) = 4 (octal)
 001 (binary) = 1 (octal)
 Octal = 141

3.9 Hexadecimal to Binary


 Rule: Convert each hexadecimal digit to its 4-bit binary equivalent.
 Example: Convert 61 (hex) to binary
 6 (hex) = 0110 (binary)
 1 (hex) = 0001 (binary)
 Binary = 0110 0001 → Remove leading zero → 1100001

3.10 Binary to Hexadecimal


 Rule: Group the binary digits into groups of 4 bits starting from right. Convert each
group to hexadecimal.
 Example: Convert 1100001 (binary) to hexadecimal
Group into 4 bits (from right): 0110 0001
 0110 (binary) = 6 (hex)
 0001 (binary) = 1 (hex)
 Hexadecimal = 61

3.11 Octal to Hexadecimal


 Rule:
 Convert octal to binary.
 Convert binary to hexadecimal.
 Example: Convert 141 (octal) to hexadecimal
Step 1: Octal 141 to binary = 001 100 001 → 1100001
Step 2: Binary 1100001 to hexadecimal: group in 4 bits → 0110 0001
 0110 = 6
 0001 = 1
 Hexadecimal = 61

3.12 Hexadecimal to Octal


 Rule:
 Convert hexadecimal to binary.
 Convert binary to octal.
 Example: Convert 61 (hex) to octal
Step 1: Hex 61 to binary = 0110 0001 → 1100001
Step 2: Binary 1100001 to octal: group in 3 bits → 001 100 001
 001 = 1
 100 = 4
 001 = 1
 Octal = 141

 Decimal vs Binary vs Octal vs Hexadecimal Counting Table from 0 to 100 decimal

Decimal Binary Octal Hexadecimal


0 0000000 0 0
1 0000001 1 1
2 0000010 2 2
3 0000011 3 3
4 0000100 4 4
5 0000101 5 5
6 0000110 6 6
7 0000111 7 7
8 0001000 10 8
9 0001001 11 9
10 0001010 12 A
11 0001011 13 B
12 0001100 14 C
13 0001101 15 D
14 0001110 16 E
15 0001111 17 F
16 0010000 20 10
17 0010001 21 11
18 0010010 22 12
19 0010011 23 13
20 0010100 24 14
21 0010101 25 15
22 0010110 26 16
Decimal Binary Octal Hexadecimal
23 0010111 27 17
24 0011000 30 18
25 0011001 31 19
26 0011010 32 1A
27 0011011 33 1B
28 0011100 34 1C
29 0011101 35 1D
30 0011110 36 1E
31 0011111 37 1F
32 0100000 40 20
33 0100001 41 21
34 0100010 42 22
35 0100011 43 23
36 0100100 44 24
37 0100101 45 25
38 0100110 46 26
39 0100111 47 27
40 0101000 50 28
41 0101001 51 29
42 0101010 52 2A
43 0101011 53 2B
44 0101100 54 2C
45 0101101 55 2D
46 0101110 56 2E
47 0101111 57 2F
48 0110000 60 30
49 0110001 61 31
50 0110010 62 32
51 0110011 63 33
52 0110100 64 34
53 0110101 65 35
54 0110110 66 36
55 0110111 67 37
56 0111000 70 38
57 0111001 71 39
58 0111010 72 3A
59 0111011 73 3B
60 0111100 74 3C
61 0111101 75 3D
62 0111110 76 3E
63 0111111 77 3F
Decimal Binary Octal Hexadecimal
64 1000000 100 40
65 1000001 101 41
66 1000010 102 42
67 1000011 103 43
68 1000100 104 44
69 1000101 105 45
70 1000110 106 46
71 1000111 107 47
72 1001000 110 48
73 1001001 111 49
74 1001010 112 4A
75 1001011 113 4B
76 1001100 114 4C
77 1001101 115 4D
78 1001110 116 4E
79 1001111 117 4F
80 1010000 120 50
81 1010001 121 51
82 1010010 122 52
83 1010011 123 53
84 1010100 124 54
85 1010101 125 55
86 1010110 126 56
87 1010111 127 57
88 1011000 130 58
89 1011001 131 59
90 1011010 132 5A
91 1011011 133 5B
92 1011100 134 5C
93 1011101 135 5D
94 1011110 136 5E
95 1011111 137 5F
96 1100000 140 60
97 1100001 141 61
98 1100010 142 62
99 1100011 143 63
100 1100100 144 64

4. Binary Operations

4.1 Binary Addition


 Definition: Binary addition is adding two binary numbers using rules:
0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry 1).

 Step-by-Step Example: Add 100 and 101.

o Why This Number?: I chose 100 (4) and 101 (5) because
they’re small numbers, and their sum (9) introduces a carry,
showing how binary addition handles carries without being too
complex.

o Step 1: Align the numbers:

o 100

+ 101

o Step 2: Add from right to left:

 Rightmost: 0 + 1 = 1 (write 1).

 Middle: 0 + 0 = 0 (write 0).

 Leftmost: 1 + 1 = 10 (write 0, carry 1).

 Write the carry: 1.

o Step 3: Result: 1001.

o Step 4: Verify: 100 = 4, 101 = 5, 4 + 5 = 9; 1001 = (1×2³) +


(1×2⁰) = 8 + 1 = 9, which matches.

o Result: 100 + 101 = 1001.

4.2 Binary Subtraction (Direct Method)

 Definition: Binary subtraction is subtracting two binary numbers using


rules: 0-0=0, 1-0=1, 1-1=0, 0-1=1 with a borrow.

 Step-by-Step Example: Subtract 1101 - 100.

o Why This Number?: I picked 1101 (13) and 100 (4) because
they’re small, and the subtraction doesn’t require borrowing,
making the direct method simple to follow.

o Step 1: Align the numbers:

o 1101

- 0100
o Step 2: Subtract from right to left:

 Rightmost: 1 - 0 = 1.

 Next: 0 - 0 = 0.

 Next: 1 - 1 = 0.

 Leftmost: 1 - 0 = 1.

o Step 3: Result: 1001.

o Step 4: Verify: 1101 = 13, 100 = 4, 13 - 4 = 9; 1001 = (1×2³) +


(1×2⁰) = 8 + 1 = 9, which matches.

o Result: 1101 - 100 = 1001.

4.3 One’s Complement (for Subtraction)

 Definition: One’s complement is a method to represent a negative


binary number by flipping each bit (0 to 1, 1 to 0). It’s used in
subtraction by adding the complement of the subtrahend.

 Step-by-Step Example: Find the One’s complement of 100.

o Why This Number?: I used 100 (from the subtraction example)


to maintain continuity, and it’s a 3-bit number, keeping the bit-
flipping process simple.

o Step 1: Take the number: 100.

o Step 2: Flip each bit:

 1→0

 0→1

 0→1

o Step 3: Result: 011.

o Subtraction Context: For 1101 - 100, we add 1101 + 011 =


10000 (simplified; end-around carry may apply in some methods,
but we’ll use Two’s complement for accuracy).

o Result: One’s complement of 100 is 011.

4.4 Two’s Complement (for Subtraction)


 Definition: Two’s complement is a method to represent a negative
binary number by taking the One’s complement and adding 1. It’s
widely used in computers for subtraction.

 Step-by-Step Example: Subtract 1101 - 100 using Two’s


complement.

o Why This Number?: I used the same numbers (1101 and 100)
from the direct subtraction to show how Two’s complement
achieves the same result, reinforcing the concept with
consistency.

o Step 1: Find Two’s complement of 100:

 One’s complement: 100 → 011 (flip bits).

 Add 1: 011 + 1 = 100.

o Step 2: Add to 1101:

o 1101

+ 100

 Right to left: 1 + 0 = 1, 0 + 0 = 0, 1 + 1 = 10 (write 0,


carry 1), 1 + 1 (carry) = 10 (write 0, carry 1).

 Result: 10001 (discard carry: 1001).

o Step 3: Verify: 1101 = 13, 100 = 4, 13 - 4 = 9; 1001 = (1×2³) +


(1×2⁰) = 8 + 1 = 9, which matches.

o Result: 1101 - 100 = 1001.

4.5 Binary Multiplication

 Definition: Binary multiplication is multiplying two binary numbers


using rules: 0×0=0, 0×1=0, 1×0=0, 1×1=1, shifting left for each bit,
and adding the results.

 Step-by-Step Example: Multiply 110 by 10.

o Why This Number?: I chose 110 (6) and 10 (2) because they’re
small, and their product (12) results in a 4-bit number (1100),
showing a simple multiplication with a 0 bit in the multiplier.

o Step 1: Set up: 110 × 10.

o Step 2: Multiply by each bit of 10:


 110 × 0 = 000 (first row, since multiplying by 0 gives 0).

 110 × 1 (shift left by 1) = 1100 (second row, shifted by one


position).

o Step 3: Add the rows:

o 000

+ 1100

 Result: 1100 (adding 0 doesn’t change the value).

o Step 4: Verify: 110 = 6, 10 = 2, 6 × 2 = 12; 1100 = (1×2³) +


(1×2²) = 8 + 4 = 12, which matches.

o Result: 110 × 10 = 1100.

4.6 Binary Division

 Definition: Binary division is dividing two binary numbers using a


process similar to decimal long division, working with 0s and 1s.

 Step-by-Step Example: Divide 1010 by 10.

o Why This Number?: I chose 1010 (10) and 10 (2) because 10 ÷


2 = 5, a simple division, and it shows the long division process in
binary with a clear quotient (101 = 5).

o Step 1: Set up: 1010 ÷ 10.

o Step 2: Divide step-by-step:

 10 into 10: 1 (10 = 2, 10 - 10 = 0), remainder 00.

 Bring down 1: 001, 10 into 001: 0 (001 = 1, which is less


than 10 = 2), remainder 001.

 Bring down 0: 0010, 10 into 0010: 1 (0010 = 10, 10 - 10 =


0), remainder 0.

o Step 3: Quotient: 101.

o Step 4: Verify: 1010 = 10, 10 = 2, 10 ÷ 2 = 5; 101 = (1×2²) +


(1×2⁰) = 4 + 1 = 5, which matches.

o Result: 1010 ÷ 10 = 101.

5. Pharmacy Application
Number systems are used in pharmacy for managing drug databases. For
example, a drug ID might be stored as binary 1001 (9 in decimal) in a
computer system. When you scan a barcode, the system converts it to
decimal to display the drug ID as 9, ensuring accurate drug identification.

 Explanation: I used 1001 (from the decimal to binary example) to tie


the concepts together. In a pharmacy system, a barcode might encode
a drug ID as 1001. The computer converts it to 9 (decimal) to display
on a screen, ensuring you pick the right drug (e.g., drug ID 9 might be
a specific medication).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy