Wave-particle duality is one of the basic features of quantum mechanics, giving rise to the use of complex numbers in describing states of quantum systems and their dynamics and interaction. Since the inception of quantum theory, it has been debated whether complex numbers are essential or whether an alternative consistent formulation is possible using real numbers only. Here, we attack this long-standing problem theoretically and experimentally, using the powerful tools of quantum resource theories. We show that, under reasonable assumptions, quantum states are easier to create and manipulate if they only have real elements. This gives an operational meaning to the resource theory of imaginarity. We identify and answer several important questions, which include the state-conversion problem for all qubit states and all pure states of any dimension and the approximate imaginarity distillation for all quantum states. As an application, we show that imaginarity plays a crucial role in state discrimination, that is, there exist real quantum states that can be perfectly distinguished via local operations and classical communication but that cannot be distinguished with any nonzero probability if one of the parties has no access to imaginarity. We confirm this phenomenon experimentally with linear optics, discriminating different two-photon quantum states by local projective measurements. Our results prove that complex numbers are an indispensable part of quantum mechanics.