Praise be to Allaah.
If this math is something which will benefit the Muslims in their daily lives and the person intends to benefit the people thereby, then he will be rewarded according to his intention. But math is not like Islamic knowledge or sharee’ah, although it is a permissible matter and a means. If it is a means that will benefit the people in their lives, then a person will be rewarded for it, because the Islamic principle is that the category of permissible things is very broad, but one issue which in principle is permissible may change to be haraam, or makrooh, or mustahabb or waajib.
We may say, for example, that selling is permissible in principle, but it may be mustahabb or makrooh. If a person wants to buy something from you that will save his life, such as food and drink, what is the ruling on selling? The ruling is that (in this case) it is obligatory. But another person wants to buy grapes from you in order to make wine – in this case selling is haraam. Another person wants to buy water to do wudoo’ and he has no water; in this case selling is obligatory. On this basis we say that if the permissible thing is a means to something which is prescribed in Islam, then it is prescribed, but if it is a means to something haraam then it is haraam.