Do good to others. That means the others are directly receiving the good. Do good for others. The others may not be directly receiving the good. Do good by others. The others consider what you are doing to be good. Some people not included in "the others" may not consider what you're doing to be good. More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.