Mathematical Methods in Nanophotonics