Taiwanese and Mandarin are basically the same language. You could argue that Mandarin is the name of the language and Taiwanese is just a localization of Mandarin. There is some differences since Taiwan was separate from the main land for so long. So words that the mainland uses for something may be different in Taiwan. There is also slightly different pronunciation. But nothing radical. From what i hear people who speak Mandarin and taiwanese can understand each other no problem.
Cantonese is a dialect of Chinese just like Mandarin, so they are almost like differant languages. To give you a example, there are 4 tones in Mandarin but 9 in Cantonese. Understanding each other is much more difficult between a Cantonese and Mandarin speaker. There are similarities but there are also major differences.
They all came from China but they developed in different regions. Mandarin originally came from more northern china i believe while Cantonese comes from southern China which is why there is such a difference between them.