 So we're going to look at azo dyes in this video, like this orange dye here or the yellow dye here. And the thing about these azo dyes is that these are synthetic organic compounds that form a majority of all the food coloring or the textile coloring that you see used in the industries. So let's look at how they are formed. But before that, I know that this is looking a little bit complicated, but we can get a feel for how these are formed if we just break them down. Like we know that this orange ring along with the OH is essentially phenol. And similarly, this yellow ring along with the NH2 is aniline and this part is common to both of the dyes. So the formation of this dye is probably a reaction between whatever this is with phenol or with aniline. So let's look at this structure a little bit closely. So I've drawn out that part of the structure separately. And as you can see, this nitrogen does not have three bonds and this is not complete. So for completion, I can write it in this form. So now this nitrogen has three bonds, but this one has four. So there's a positive charge here. And because it's a cation, we write it in the form of a salt with a X negative. So this group of the N2 with a positive charge is called a diazo group. So if we have some group attached to this nitrogen, let's call it R and we have a X negative here. So these type of structures can collectively be called diazonium salts. And this X need not just be a halogen. It can also be a group like an HSO4- or a BF4- And one more thing about this ion is that it is resonance stabilized. So if we were to draw the resonance structures of this ion, it would look something like this. And you can see how when we shift these bonds, we get these resonance structures. So the point here is if this group R is say an alkyl group, there will not be any resonance. And hence the resulting ion will be highly unstable. And therefore it will not be available for the reaction. But here since R is an aromatic ring and because we have resonance is why this ion is stable. So now before we go to the dye formation, let's see how these diazonium salts are formed. To form our diazonium salt, we start our reaction with aniline and we're going to react it with this NaNO2 and HCl. Now what these reagents are going to do is they give us this nitrogenium ion and we have the lone pair on the nitrogen attacking this nitrogen and we get this NaO group added here with a positive charge on this nitrogen. So now as this bond shifts, we have this hydrogen leaving and we form a double bond here with the hydrogen now getting attached with this oxygen. Next we have this oxygen picking up this H+, coming from the solution and when this hydrogen leaves, we have water leaving from here forming a bond between these two nitrogens giving us our diazonium ion. And I can write it like this with this Cl negative coming from the solution which is electrostatically bonded to this ion. So now that we have formed our diazonium salt, let's see how we can react it with phenol and aniline to get the azo dyes. So now to get to our dye, we start with our diazonium salt and we react it with phenol in a basic medium. And as we know about phenol, the first step that's going to happen is this OH negative will take off this hydrogen. So now we have a negative charge on this oxygen and because of resonance, we know that this negative charge will form a bond, these double bonds will shift and because of which you will have a higher electron density at the ortho and the para positions. And similarly we will have resonance here. So we have this bond breaking here because of which we now have the positive charge on this nitrogen. So if you look at these two closely, you'll notice that we have seen these sort of reactions before where you can think of this as an electrophile and this as a nucleophile. And because we know that the electron density will be higher at the ortho and the para positions, we will have this nucleophile with increased electron density at the para position attacking this electrophile. One more question you can ask here is that instead of the negative charge at the para position, can this negative charge, which is on the oxygen, attack this nitrogen? And the point is because oxygen is more electronegative, you will tend to keep these electrons with it whereas if this negative charge is on this carbon, carbon having a lower electronegativity will want to get rid of these electrons. Or in other words, it will be a better nucleophile. So the attack by this carbon is more probable, which is why if we draw the resonance structure of this phenol with the shifted double bonds and the negative charge at the para position, we get this nucleophile, which will attack this nitrogen of the electrophile and we form a bond here. But there is a hydrogen here. So what will happen is this hydrogen will be taken off, restoring the aromaticity of the ring and it will go and get attached to this oxygen, giving back our OH and so we have now formed our orange dye. Now let's see how a very similar reaction takes place with aniline to form our yellow dye. So this reaction is going to be very similar to the one with phenol that we saw before. But the difference is that with phenol, the reaction was in basic medium to help form the phenoxide ion. The reaction is going to be in acidic medium and the acidic medium is important because this nitrogen on the aniline has a lone pair, which may react with the incoming electrophile. So we are using the H plus from the acidic medium to sort of block this lone pair so that we can make sure that it doesn't interfere with the reaction. So we have aniline reacting with our diazonium salt in an acidic medium. So first we have the formation of this anilineum ion when the H plus from the acid is attached to this nitrogen and again as we have seen before this nitrogen is now going to pull electrons from this ring. So the electron density will be very low at this carbon and as we go away from this nitrogen the electron density increases. So we know that now the electron density will be highest at the para position and again we know that there will be resonance here. So we have this bond shifting because of which we now have a positive charge on this nitrogen which will substitute the hydrogen here and we form our product which was a yellow dye also called aniline yellow. So we looked at two dye formation reactions the first was the reaction of our diazonium salt with phenol in a basic medium which gave us this orange dye also called phenol orange and then we had the reaction of this diazonium salt with aniline in an acidic medium which gave us the yellow dye or aniline yellow.