The word "math" is capitalized when it comes at the beginning of a sentence and when it is part of a specific course title. It is not capitalized when it is used as the name of a school subject.
In the sentence "Martha did her math homework first," the word "math" is not capitalized because it is referring simply to a school subject. In the sentence "Martha is taking Business Math 201," it is capitalized as part of the title of a specific course. The same rules apply to all school subjects except for the names of languages, such as English, French or Spanish, which are always capitalized.