 Hello, everyone. Welcome to this session. I am Dr. Asha Thalange and today we are going to learn Shannon Fano coding technique. At the end of this session, you will be able to encode the messages of the transmitter using Shannon Fano coding technique. These are the contents we will be covering in this session. Now before actually starting with the Shannon Fano coding method, think for a while what all different coding methods you have used or studied before. Well, the most common coding techniques that we know are decimal to binary coding, xs3 coding, encoders, Morse code, etc. In all these process, we convert one form of representation into another form. So what are these coding techniques all about and why we use them? Let us first understand this. In general, coding means the process of converting the set of messages into new coded messages. In any communication system, reliable and efficient transmission of information is must. This is achieved by using different coding techniques which removes redundancy in the data and provide error detection and correction. Mostly the coding techniques are used for data compression, cryptography, error detection and correction, data transmission and storage, etc. Broadly, coding techniques are classified into four types. Source coding, channel coding, cryptographic coding and line coding. Let us see what is source coding. Source coding is used to encode the transmitting messages into binary code with one-to-one mapping between the message and its code word. This coding is done in such a way that its average length of the code word is smaller or minimum. As the average length is decreased, this in turn increases the efficiency of the system. Different data compression techniques are good examples of source coding techniques. Some of the applications of this coding techniques are Faximile, JPEG, MPEG, etc. Let us now see what channel coding technique is. Channel coding technique is used to encode the source messages with some additional information. This additional information is used to provide error detection or correction in the transmitted data at the receiver in order to reduce probability of error during transmission. But due to this additional information along with the original message, redundancy of the data is possible. And this increases the bandwidth requirement. Well, the known examples of channel coding technique is linear coding techniques. This coding technique is used in applications such as voice band modems, GSM mobile phones, satellite and military communication devices. When security is a major concern, cryptographic coding technique is used. Thus, this coding technique is used to encode the transmitting messages so as to provide secured communication and privacy over an insecure channel. Most common examples of cryptographic coding are different encryption and decryption algorithms used for coding. These are generally used in the application where security is highest priority such as ATM cards, e-commerce, computer passwords, etc. Let us now see line coding technique. In line coding technique, the digital data of the source is represented with different voltage patterns and transmitted. It is somewhat similar to digital to analog conversion but with discrete timescale access. This technique is used in baseband data transmission system. Common examples of line coding are unipolar coding, bipolar coding, Manchester coding. These coding techniques are generally used in computer communication networks over short distance. Now with this background about coding techniques, let us now study Shannon-Fano coding technique. Shannon-Fano coding technique is one of the source coding methods. It constructs reasonably efficient, separable binary codes. Let us see the steps involved in coding the message using Shannon-Fano coding. First, arrange the given messages in decreasing order of their probabilities. Next, partition these messages into M equiprobable message subsets where M is number of symbols or letters used to code the messages. For example, if M equal to 2 then two symbols are used that can be 0 or 1 or else if M equal to 3 three symbols can be used for example 0 1 and 2. Next, assign one symbol to each subset that means for example if M equal to 2 then assign 0 to all the messages in first subset and 1 to all the messages in the second subset. Next, again partition each subset into M equiprobable message subsets and assign the symbols to them as stated in step 3. Continue this process till each subset consists of only one message. Code word for each message is then obtained by reading the symbols assigned to them from left to right. Let us understand us with some example. In a communication system the source transmits four different messages say x1 to x4 with the probabilities 0.3, 0.1, 0.5 and 0.1 respectively. If the number of symbols used to code these messages is 2 then find the code word for each message and coding efficiency by applying Shannon-Fano coding method. It is a straightforward example. Here messages are x1 to x4 with their probabilities 0.3, 0.1, 0.5 and 0.1 respectively. Also as two symbols are used M equal to 2. Let those be 1 and 0. Let us solve this referring the steps provided. First arrange the messages in the decreasing order of probabilities. Now these are the given things. We see that x3 has higher probability and x2 and x4 have lowest probability 0.1. Thus after arranging we get x3 at the top and x2 or x4 placed at the bottom. Step two partition messages into M equi-probable subsets. Here M equal to 2 that is we need to divide this into two parts such that the difference between sum of probability of these two subsets is less. This is how we divide. Now the sum of probability of the first subset is 0.5 and the sum of probabilities in the second subset is 0.5 that is both are same. Next assign one symbol to each subset. Here M equal to 2 and the symbols used be 0 and 1. 0 is assigned to messages in one subset and 1 is assigned to all the messages in the second subset. You can note that you can also assign 1 to the upper subset and 0 to the lower subset. Next again partition each subset in M equi-probable subsets and assign the symbols. We can see the top subset consists of only one message x3. Hence it cannot be divided further and the second subset consists of three messages and hence can be further divided. So the possible partition of second subset is as shown. Assign 0 to the messages in the above partition and 1 to the messages in the lower partition. Continue the process till each subset consists of only one message. Thus the last subset is partition as shown and 0 is assigned to the messages above partition in that respective subset and 1 is assigned to the messages below partition in that respective subset. Thus we can now see each partition or subset consists only of one message and hence no further partition is possible. Now the code word for each message is obtained by reading the symbols assigned to that message from left to right. Code word for message x3 is 0, for x1 is 1 0, for x2 is 1 1 0 and for x4 is 1 1 1. This gives the length of each code word to be 1 2 3 and 3 respectively. Thus this table gives the summary of code word and code length obtained for each message using Shannon-Fano coding method. Now to find efficiency we need to calculate average length of code word and entropy. Average length of code word for each message is given by l bar is equal to summation of nk pk k ranging from 1 to n where nk is length of the code word and pk is probability of kth message. Expanding this equation and substituting the values of nk and pk from the table we get average length l bar equal to 1.7 letters per message. The entropy is given by h of x equal to minus summation of pk log pk k from 1 to n. Expanding this equation and substituting the values of pk we get entropy h of x is equal to 1.685 bits per message. Thus efficiency is now calculated by using equation eta equal to h of x upon l bar into log of m to the base 2 which on substituting the values gives 0.99. That is efficiency is 99 percent. Thus we have now seen how Shannon-Fano coding technique is applied to find code words and efficiency of a system. In this case there was no ambiguity in partitioning the messages. We were able to decide the partition easily but there are some cases when there is confusion in where to apply the partition. So in the next session we will see how to solve such problems having ambiguity in them. These are the references used. Thank you.