Suppose the first person you choose is a math major- there are 6 ways to do that. Suppose the second and third persons are also math majors. There are 5 and 4 ways of doing that so there are ways to choose the three math majors. Do the same to find the number of ways to choose 2 physics majors. That's 5 of your commitee. The last two can be chosen from any of the remaining 7+ 5= 12 students. There are ways to do that. Multiply them altogether.

Finally, divide by the number of ways to order "MMMPPEE" ("M" for "math major", "P" for "physics major", "E" for "either") so you are not counting different orders of choosing the same people.