Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
42 views27 pages

Binary Numbers

Uploaded by

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

Binary Numbers

Uploaded by

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

Ifationtishattentied

ways to write mathematics


It makes it possible to discuss and understand
mathematic in an efficient way

An example of basic mathematical notation is


multiplication When we write
3 5
it means add three copiesof 5 ie
3 5 5 5 5
Multiplication is a shorthand for repeated addition
In mathematics there are oftenmultiple ways to
write the same thing Foreg l've used x for multiplication
but there are other ways to indicate malt For eg a dot
or an asterisk can also mean Mutt Thus

3 5 3 5 3 45
There aredifferent reasons for using the different
symbols For e.g if I want to mult 3 by x then
the X for mult is ambiguous as X and x are
too similar I might use insted as it's clearer ie
3 x
rather than 3 xx The dot can be ambiguous as well
I have 3 2 times X written as 3.2 x
For
eg if that
then is 3 times 2 times scar 3.2 times se

Having multiple ways to write the same thing in


maths allows us to choose the bestapproach for a
given situationSometimesthough it down to personal
choice
There two other ways to indicate malt namely
are
brackets and juxtaposition ie writing them beside
are another If I want to write 3 times x then I
can write it as

Gc on 32
brackets mean juxtaposition
multiplication

M pageihtpsllelearning
view
ta.tudublin.ie
id
php 6190

i teamm
three times five
two nos For eg is 35 or
thirty five
Brackets always mean mutt and if there is any
risk of mis interpreting something we always use
brackets to make it clear

Another example of mathematical notation or shorthand


is for repeated multiplication
Suppose we have
6 6 6

then we can use power or indices the write this in


the shorthand
power or index

base
163
on
basenumber

The 3 is a
specif ie raised and reduced in size
A subscript would be lowered and reducedin size
When we write 105 we mean mult five copies of lo ie
105 LOXIOXIO X10 10
read as 10 to the power of 5

This works for variables as well Foreg

x means XXX

We could also use a variable for the index on power For


eg
pay
means mult y copies of x Sometimes we want to
write something like this in expanded form but we
don't know the specific value g y so we write it like
this
I

y copies
The symbol is called an ellipsis and it means
and so on We use it when we don't know how
many pieces there are on when there's too many
to write down For eg
It 2 50
means the sum of the nos from 1 to 50
What Rules Apply to Powers
suppose I mult 3
by 33 What do I get
32 33 3 3X3 3 3 35
expanded
form
Thus 32 33 35

Eg 6 X 65 6 6 6 6 XGX6 6 6 6 69

More generally if b and c are whole nos then


aba x
ex

boopingecopied
This gives us the following rule for powers
abal able
where a b and c are numbers and b and c are
positive whole nos Cie 1 2 3,4 etc also known as
the positiveintegers
There are some special cases to think about For eg
a a
ie multiply are
copyof a
What would a mean We'd like to extend our idea
of powers to work for any no as a power We'd like
for eg to be able to have things like
20 an 2 an 32 7
Weneed to decide what these things mean and we'd
like our rule aba abt to work in all these cases as
well If we want this there is only one choice for a
ie
a I
similarly
a
ta
We can see why as follows
abd abto ab
Then
abd ab 0
abad ab I o
ie abCao 1 0

If a in't zero then a i o ie d l

The net resultof this is that for a to be consistent


with the rule
abac ab ta
is if
a I
provided a o

In a similar way we find that to make our rule


aba abt work for negativepowers we need
at
ta
Followingthisapproach we endup with thefollowing rulesforpowers

1 I I 30 1
2 a a 3 3
5
3 aba ab 2325 23 28
4 a provided a of 3
ta
5 ab tab provided at o 5
I
6 fab a'be 12 315 25 35
2
7 ab abc 43 43 46
8 a'th
n Na
3112
5312
F
q.am nfm V55

Notes
G in rules if's saying that when a number is broughtabove or
belowthe line the sign it'spowerchangesThus
of
b
a
atb
a
I
or

Eg 53
I
53
Eg
I
To see whythis is so

1x 53
Is
Is 53
Recall To divideby fraction turn it
a upsidedownandmultiply

121To see
why a th Fa consider 312 If I multiplythis by
itself ie
31 1 k
3112 31 2 2
3
3112
Thus is the no youmultiply byitselftoget 3 ie you square3112
to get 3 a putanother
way 3 in thesquarerootof 3
3115
Similarly is the no youmultiplybyitself 5timestoget3 ie
the 5throotof 3

3115 315 315 315 3115 3115 1154115115175 3 3

Saneex mples

1457 Rule 5
Eg 41,2
3
Eg C B C l x135
CI X
133

IX I X 1 133
133
1
133

Note Becareful with signsand powers

In 13 the minus is notaffectedbythepower whereas in C1 it is

Eg C13 13x C73


132

132 13 13
Eg
Don'twrite 132 when
you mean C137 they are notthe same

Eg 72 Rule 5
42
Eg 53 Rule 5
I
7
Eg Write53 2 as a fraction
53 7 53X
If
2

The rulesworkthe same if we are usingsymbols variable Foreg

4 is
3 153
or
2x
2 4
Note powers of 1 are usually to save writingand clutter

Isi set p
Eg
I
16 1.6
227 227 pen
Eg off
Eg Simplify Gey here x and y standfornumbers

rays a 36553 Rule6


eat3 y5 3 Rule7
poky's

Suppose so 1 and y 2 their

xpy't 112 215 32768

Important Youcan'tadd the powers unless the numberraisedto


eachpower is the same Thus

x'y't Hy
but
if x
y xxx
yy Notthe same
915
xy.xg.xy.xy.scy says
Numbersystems
We are interested in the numbersystems decimal which we useday
todayI binary used in computersystems and hexadecimal which
makesbinary more readablefor humans

Thedecimalnumbersystem is a positionalnumbersystem that uses


the digits 0 to 9 and powers of 10Thepowers oflo for a number
largerthan I start with 100 forthe rightmostposition withthepower
increasing 1 foreach positionyou move to the leftThus we have
by
10210100

Consider the decimal no 3271 For eachdigit there is a corresponding


powerof 10 as follows

so 3271 actually means


l
3 103 2 1047410 1 100

This is called the expandedformof 3271

Eg Write 51737 in expandedform

1 14
51737 5 104 1X103 7 102 3 101 7 100

Because decimal uses powers of 10 it'softencalled baselo It's a


positional number system because the valued a digitdepends on it's
position

This works the same fornumbers with a decimal portionexcept


2
we need negativepowers of 10 ie 10 10 etc Recall

10
102
Yo too

etc
Foreg the number 312 1 means

10210 100
3 I 2

3 18 1 10 t 10
700 1x
2
t t t t
hundreds tens units tenths

Eg Write 5327.235 in expandedfam


2
103 18 10 100 10 10 103
5 3 2 7 2 3 5

5327 235 5 103 3 102 2x10 7 10 t 2 10 3 102 5 103

Computer systems use two states Coli ONoff to represent all


or
the informationtheyprocess To represent a number in such
a system we have to beable to represent it
usingonlytwo
valuesThis is binary which is a positionalnumbersystem
based on powers of 2 unlike decimal which uses powers of10
usingonly the digits o and I unlike decimal which uses 0 to 9
Abinarynamber is a sequence of binarydigits alsoknownas
bits namely 0 or 1 Therightmost bit in 20 the nextrightmostis 2
then 2 and so on

Foreg 1012 is a
binarynumberand it stands for
1 22 0 2 t1 20
ie

The subscript 2 indicates 2 number By default


a base if there
is no subscript a number is base 10

Thus 101 means1 104oxto'tlx100 ie are hundred and out


while 1012 means 1 22 0 2 7 20 ie
1 4 0 2 11 4 0 1 5

Then 1012 510

Upshot 101 is not the same as 1012

ffwentt.FIanffdeitmal writethe number in expandedform


calculate the powers of 2 multiplyeverything out and add it up
Eg Convert 11101 to base 10

Haiti
11 70 12 1 2 1 23 1 2 0 2 t1 20
1 16 1 8 I 74 0 2 1 1
16 8 4 to 1
2910

If youknow the powers of 2


you may find it helpful to use
them directly

Eg Convert 1711010102 to decimal

144 11 lil
1111010102 1 256 1 128 1 64 1 32 10 16 1 8 074 172 0 1

256 128 64 32 to 8 0 2 0

490

Eg Convert 110001111012 to decimal

19888111
1 1024 512 0 0 10 32 16 8 4 0 1

1597

Exercise Convertto decimal


i 101071112 Ans 175
2 1100001112 Ans 391

kemaindent
Quotients
If a and b are wholenumbers 1,2 3 and we divide a
by b it will go in some whole no of times g calledthequotient
and there will besome leftover amount r calledthe remainder

Eg If we divide 16by 5 then q 3 because 5 goesinto 16


threetimesThe leftoveramount is 1 because
Cremainder
16 3 5 T
a
MIT
q
quotient
5 1007 5

If a b are non zero wholenumbers then we can write a in


the form
a bqtr

and this is unique provided r is less than 3

Eg 23 11 2 1 9 23 b 17 q 2 r 1

Eg 172 23177 11 9 772 1 23


q 7 r 11

Notethat q or r could bezero

Eg 35 37 o 35 9 35 D 37 0 r 35
9
Eg 82 41127 0 9 82 6 41 g 2 no

IYItgfn119at Gf.this will giveyou a decimal


value

qt gift
Here r is in decimal farm To get r as a whole no subtract q
whichis 9 in this case to only leave the remainder ie

0 2962

and then multiplythis bythe numberyou divided by lie 27


to get
27 0 2962 8

Thus
251 27 a 8

Exercise Find q and r when 1296 is dividedby97


1296 91 91114 22

gonfanteroffiffffany divide the number by2 and


record the remainder which will be either 0 or D Then
divide the quotient partagainby 2 and record the remainder
Repeat the process until the quotient in zero Writedown the
remainders in reverse order to getthe binaryvalue

Convert 837to
Eg binary
2 837
837 11010001012
209 r O
104 r I
O
4 52 r
o
26 r
13 r o
6 r I
3 r o
r 1
f gym
i t
quotient remainders

Tip if dividing an even no by 2 the remainder is 0 and if


dividing an odd no by 2 the remainder is 1
Eg Convert 5106 to binary
2 5106
2553 r O d 5106 1 0011 7771 00102
1276 r 1
638 r o
319 r o
759 r I

I
L 39
79 r
n
I
I

9 r I
4 r I
2 r o
I r O
o n I

convert to binary
Eyerge 1000 10112
121 6471 I 1001 0100 07112

ÉÉw hex writesnumbers using base16 Weneed 16 symbols


as
to represent it We use 0 9 as before but insteadof inventing
new symbols we use A B C D E F
upper or lower case is fine
Thus in order we have seetablenext
page
Conversion to fromdecimal is similar toconversion tofrom binary

Eg Convert 3713716

163162 16 160
3 F B 7 3 763 FX162 BX16 X 7 160
3 4096 15 256 11 16 7 1
16311
9 4
1 70
2 2 B 71
3 3 C 12
wgitfecimateauivant
4 4 D 13
5 5 E 14
G F 15
7 7
g 8

Exercise Convert ABF316 to decimal

163162
16 160
A B F 3 AX163 Bx16 t Fx16 3 160
10 4096 11 256 15 16 3 1
40960 2816 240 3
44019

To convertdecimal to her proceed as for decimalto binary


except we divide by 16 insteadof 2 The remainder can now be a
valuefrom 0 to 15 lie 0 to Fl and as in the binary caseyou
read the answer upwards

Eg Convert 31408 to hexadecimal

16 31408 31408 7ABO

4
I r lo A
f
read answer
upwards

Exercise Convert 173771 to her


d
16 173771 173771 2AGCB
10860 r p p

f
678 r 12 C
42 r 6
2 r 10 A
O r 2

tch
Ii 2ÉT hexadecimal digit is equivalent to a binary
bits
24232421W
these4 binarybit give
0 to 15 decimal ie
o to F in hex

This makes binary hexconversioneasyusing a conversiontable

Bignst
0001 1001

y
0010 1010
0011 1011 B
0100 4 7 100 C
0707 5 1 107 D
0110 6 1 1 10 E
0 I1I 7 1 71 1 F

Toconvert binary to hex divide the numberintoblocksof


4 bits from right to left and then use thetableto convert
eachblock If the leftmostblockhasless than 4 bit pad it on
theleft withzeros toget a bit
Eg Cawert 7701101101102 to her
D B 6

1101107107102 DB616

Eg Convert i 1071110110102 to her

Pad the leftmostblock with zero's to


get a bit
0001 10 11 1107 7010
1 B D A

Ans IBDAIs

Hex to binary is just as easy

Eg Convert 543716 to binary

5437,6 0101 1010 0011 01712

ÉÉÉwert 11011101112 to her


fleawort BBAlie to binary Inn Yo ion too cool

Hexis useful because g the of conversion tofrombinary and


ease
it's easier to read than raw
binary
IPaddresses are binarynumbers butthey are usuallygiven in
hexadecimal for cawience

IPv4 uses 32 bit binarynos ie d groupsof 8 bitsForog

0011 1710 0701 1111 0111 0001 10001011


wouldbesuch an address It'shex version is

3E 57 71 8B
Exercise A MACaddress has last threebytes F1 CB A3 convertthis
tobinary

Ans I111 0001 I 100 1011 1010 0011

eTwtohThow to calculate
powersof a base B but we oftenwant
to answer the question what powerof a base Bgivesus a
particularnumberForeg what power of 10 equals20 Thatis
whatis K it
18 20

Forsome numbers this is easyto answer Foreg what is x if


10 1000
Since 103 1000 se must be 3

This no si is the calledthe logarithmof1000to base A logarithm is


a numberwe use as a power

Since 26 64

so the logarithmof 64 to the base 2 is 6

If BCB M and C are positivenos then we can ask whatpower


on of B gives C The valueofol is the logarithm of c to the base B
and we write
a logBC

to mean that B C
andviceversa

If 13 10 ie base10 we usuallyomitthe base writing

log20
forexample insteadof log020
Onthecalc
log 20 1 307029996
so
101.3010
20

Weoftenround longdecimals to a smaller no ofdecimal placesThis


small inaccuracy which may or may notbeacceptable
introduces a
depending on the application

Eg If we round the previous resultto a decimalplaces we


get
10920 1 30 Codp

but thisgives
10130 19.9526 ad p

so our answer is slightlyinaccurate Moredecimal places more

accuracy 301
lol 199986
30103
101 20 000000

If we knowthe logof a number we can get back that no by


raising 10 to that log This means we can use the log of a
number in placeof that no forcertain purposesThey are not
the same but we can always getare from the other

Sincelogsof largenos much smaller they are often more


are
convenientto workwithSamephysicalscales cover a very wide
range and using logvaluesmakesthem easier to work with

EgTheenergy in a whisper is about a billiontimes less than the


energy in the noise of a rockconcert ie a rangeof
1 1000000000

Since log7 0 and log1000000000 9 we can use a log scale


from o to 9 to represent the rangeofenergies in thesesounds
Thisis called using a logarithmicscale

Examplesoflogscales include pH in chemistry d13 inengineering


andthe Richterscale in seismology

Foreg a tremor ofmagnitude 4 is 100times more powerful


than are ofmagnitude 2 because the differencein magnitude
is 2 corresponding to 102 ie 100

Foreach 1
yougo up on the logscale the actual valuegoes up
by a factorof 10
Somelogrades baselol

log 1 0 because 100 1


fog10 1 10 to
fog100 2 10 100

Whatis log ie logo

logo I 1 because 10 o 1

Similarly log 0.01 2 because 102 0.01


I to
Notice that logs can benegativeLogs numbers less than I are
of
negativeThis means we can handleverylarge and small very
numbers with logs

Eg 10 10000000000 so log10 11
0
10 0 000001 so log106 6

Foreachfactorof 10change in a value the corresponding


logvaluechangesby 1 If we gofrom lo to 100 we increase by a
factorof10 but thecorresponding logvalueincreasesby f ie from 1
to2

Recallthe basicruleforpowers

109101 loath

Foreg 102103 1023 105

There is a corresponding rule for logarithms

log AB logA logB

Thelogof a product is the sum of the logs

Eg log1000 log lox10 10

logto logto logto


I It 1
3

Using alogscale linearises a scale ie goesfrom a scalethat


changesbymultiplesofsame numberdo in cases we'rediscussing
to a scale which increases in stepsof 1 Theoriginal scale is
non linear ie it'sgraph is a curve

10togo to

i
thenext
division ii

10960 1.77823 Add 1 to goto the nextdivision


femalitemffwanatt
is a measure of the power in a signal
If's definedto be

PowerdBm 10log
Piggy
where 1mW is on milliwatt ie 1000thof a Walt where the
Waltin a unit of power

Eg Convert 200mW to decibel milliwatts The result is

101091299pA 10109200

23.010

23 dBm Cod p

Eg Convert aw to dBM

We can't use 2W directly because the formula uses milliwatts


andyoucan't divideWatts by milliwatts You must use values
with the same size or scale of units I'llconvert wattstomilliwatts
Amilliwatt is 10007h g a watt so 2W 2000mW and

tolog12099MW 1010g2000

33 01
I 33dBm Cod p

Exercise Convert it 5320 mW to dBM


ii 15W to dBm

i 10log1532,9Mt tolog5320 1073.7259 37 259dBm13d


p

I 15W 15000mW so
tologfsgqumw 10log15000 10 4 176 41.76413m 2d p

transposingformulasandtguation

Aformula represents a relationshipbetweentwo or more quantities


Foreg Ohm's law
V IR
relates the voltagetothe currentand resistance in a simplecircuit

IT
knowthevalues fortwo ofthe
If we
three V I R we can calculate the
My third using theformula

Anotherexampleof a formula is

T
L
where Tin thetransfertime for a file ofsizeb in bits over a
channel with transmission bit rate c

Anotherexample is
f
t
where f is the frequencyof a signal and T is it'speriod

If we providevalues for all the quantities in a formulaexceptare


then we can use the formula to find the valueofthat
Continued on next
page
Eg Use Ohm's law tofind V if I 3 and 12 2

K IR so V 3 2 6

Eg Find I if K Z and R G

Since F IR we get 2 1167 ie 2 GI ie

I
2
Note I'mignoring units at the moment

EgHowlong would it taketotransmit a fileof106bits over a


channel with a bitrateof 5000 bitsper second

If
T
be
persecond t.tt secs

200sees

Formulas are usuallygiven with quantitybyitself on one


are
side gthe formula calledthe subject oftheformula In FIR V is
the subject and in f it f is the subject

Aformula can be rearrangedto make a differentquantitythe


subjectThis is called transposingtheformula

An expression is any piece defamed mathematics fie obays


alltherules ofmathematics It can be a singlequantity or more
complex and expressions can becombined to make more complex
expressions
Eg s ut t at

In thisformula ut all expressions So is ut


fat Iat
s are

To transpose a formula we want torearrange it to make a


differentquantity the subject
Forsome simpleformula's like KIR there is a simpleshortcut

EgTranspose Ohm's law ie V IR to make I the subject

Constructthe
triangle

HI
Toget the formula with particularsubject cover that item
a
and what's left is the formula ie

IR
I K
R
R
E
Eg Transpose f
I
so that T is the subject

1
Then T I
f
is the required formula

Exercise In make b the subject


the
1
The required formula is

D TC

Instead
of making b the subject a question may say isolateb

fT BC isolate B andcalculateit's value if A 4 5 and C 7

1 0 64
Isolating B B 5
4
Exercise
If A isolate f and calculateit's value if 7 13211and
g
3 18

Isolate
f f 332,1 22708.35 ad p
z

You might also like