The goal of capital punishment isn't to prevent these types of crimes (the law is there to do that), it's to ensure these types of people don't have a chance to commit them again, as they've clearly shown they had no problem doing it before they were caught. It isn't for the good of the criminal, it's for the good of the society. Whether it works is debatable but that's the reasoning behind it. There are of course cases of innocent people being imprisoned, perhaps on death row, but no system is without its faults (not saying it doesn't need improvement). At least in the US, prisons are already over capacity and conditions for inmates are terrible with all the crowding.
You don't have a chance to re-offend if you're given a life sentence without chance for parole.
Hal addressed the crowding issue. It's in lower security prisons, not lifers/death row.
If you want to better prevent murder and other heinous crimes, there are many socio-economic factors to consider; but even if all of them are fixed and just about everyone is happy, there will still be the psychotics and sadists who take pleasure in inflicting pain onto others, and enjoy taking their lives away. What would you do with them?
Psychosis is a medical condition. Maximum security medical facility for treatment. Otherwise, imprison them for life to remove them from society.