 Hello and welcome to this session in which we look at an alternative way of representing natural numbers which is the binary representation. So, in general there can be many different ways in which you can define the same abstract data type and different ways of defining can also suggest different ways of representing them and also different data structures for the same abstract data type and these can have different properties based on the way you are defining the abstract data type. So, let us look at binary representation for numbers. So, we have seen one way of defining numbers using piano axiom. So, this can be thought of as using a unary representation to define the number n we represent it as next of next of next of next of 0 where we have to apply the next operation n times to get the value starting from 0. On the other hand binary representation gives a more compact way of representing numbers the same number can be obtained by using much fewer number of operations than n next operations that are needed. So, how do we define using binary representation? Again the idea is similar we first define that 0 is a natural number which is given to us. Now, we have two operations rather than having just one operation. So, if n is a natural number then we say double of n and double plus 1 of n are also natural numbers. So, we have two operations given to us one is called double n and another is called double plus 1 n. We have the additional property given that double of 0 is always 0 it is defined to be 0. So, this property must hold and similarly as in the case of piano axiom if we know that a property holds for 0 and assuming it holds for n we can show that it holds for double n and double plus 1 n then it holds for all natural numbers. So, to prove any property for all natural numbers again we need to show that it holds for 0 and assuming that it holds for a number n it should hold for the number double n and it should also hold for the number double plus 1 n. So, now we have two operations and we have to show that even if we apply any one of them the property continues to hold. So, this gives us a more compact way of representing numbers. For example, the number 10 would be represented as we start with 0 apply double plus 1 then double then again double plus 1 and double. So, informally double plus 1 means you double the number and add 1 to it double just means double the number. So, if I do apply double plus 1 to 0 I get 1 then doubling that I get 2 double plus 1 again gives me 5 2 into 2 plus 1 is 5 and doubling that gives 10 again. So, you can say this suggests the binary representation of numbers and this takes about log n operations to represent the value n. So, in some sense we can say this is a more efficient way of representing numbers we will be studying later what efficiency means, but compared to n next operations needed using the previous definition here we can do it with only log n operation. Now, everything remains the same just like we defined operations using the next we can define the operations using double and double plus 1 the next operation itself can be defined using these two operations. So, define next in terms of double and double plus 1 next of 0 is the same as double plus 1 of 0 essentially double 0 2 times 0 is 0. So, this is same as next 0 next of double of n is defined to be will be double plus 1 of n and next of double plus 1 n will be double of next of n. So, you add 1 to n and double it that is like finding next of doubling n adding 1 and then taking its next. So, once next is defined in terms of these two operations we can define all as we have done previously all other operations get defined in terms of these. So, but we can directly define these using double and double plus 1 itself which again gives a more compact way of defining and also more efficient way of performing those operations. So, let us try to define the add operation using binary representation. So, add of 0 comma 0 is 0 add of double m comma 0 is double of n and add of double plus 1 m comma 0 is double plus 1 of n. So, this just defines add of m comma 0 for all numbers n and that is always equal to m. Now, we will define add of m comma double n to do that we first define add of 0 comma double n which will be double n itself. Now, add of double n comma double n is essentially double of add of m comma n. So, if I have defined add of m comma n I can define add of double n comma double n. So, assuming add of m comma n is defined for all n I can define add of double m comma double n in terms of add of m comma n and add of double plus 1 m comma double n will be double plus 1 of add of m comma n. Now, this defines add of m comma double n for all numbers n. Now, we similarly need to define add of double m comma double plus 1 of n. So, add of 0 comma double plus 1 n is double plus 1 n add of double m and double plus 1 n is double plus 1 of add of m n and add of double plus 1 m double plus 1 n is double of next of add of m n. So, again think of double as 2 times m and double plus 1 as 2 times n plus 1 then you can figure out what this definition means. Note that we are using the next operation here in defining the last operation, but next can as we have seen be itself be defined in terms of double and double plus 1. So, this gives the definition of addition using binary representation. So, here is an exercise for you to think over. Suppose we want to add two numbers m and n, how many times would the next operation have to be used to compute add m n, if we are just allowed only the next operation. So, remember we had given a definition of add m n in terms of the next operation. So, you just try to apply that definition and see how many times you need to evaluate the next operation to get the final answer add m n. And now do the same thing where the addition is defined using double and double plus 1 operation. So, again if I want to compute add m n, in this case I assume that m n are also defined using the double and double plus 1 operation. So, assuming that they are defined in terms of these, how many of these operations are needed to evaluate the sum of m and n. And you can try and compare the two methods and see which one needs pure operation and therefore, this is more efficient. So, as we will see later on we will be looking at many alternative ways of defining the same objects and which suggests many different ways of implementing them and we compare them based on their efficiency. So, thank you.