The meme originates from the 2018 animated movie The Incredibles 2.
Mr. Incredible, who is one of the movie’s protagonist, tries to help his son Dash with absolving his math homework. He says math is math in an agitated way, soon after they start the session.
This happens because, though he solves the equations, his son keeps mocking him for the reason he doesn’t use the methods that the school teaches to them.
In the same year of the movie’s release, the frame of Mr. Incredible saying “math is math” was posted to /r/ dankmemes.
Later it was also featured on 9gag. That appearance and exposure eventually brought the success for the meme format.