Theory of electromagnetic waves