This paper presents an analytical approach for solving the weighting matrices selection problem of a linear quadratic regulator (LQR) for the trajectory tracking application of a magnetic levitation system. One of the challenging problems in the design of LQR for tracking applications is the choice of Q and R matrices. Conventionally, the weights of a LQR controller are chosen based on a trial and error approach to determine the optimum state feedback controller gains. However, it is often time consuming and tedious to tune the controller gains via a trial and error method. To address this problem, by utilizing the relation between the algebraic Riccati equation (ARE) and the Lagrangian optimization principle, an analytical methodology for selecting the elements of Q and R matrices has been formulated. The novelty of the methodology is the emphasis on the synthesis of time domain design specifications for the formulation of the cost function of LQR, which directly translates the system requirement into a cost function so that the optimal performance can be obtained via a systematic approach. The efficacy of the proposed methodology is tested on the benchmark Quanser magnetic levitation system and a detailed simulation and experimental results are presented. Experimental results prove that the proposed methodology not only provides a systematic way of selecting the weighting matrices but also significantly improves the tracking performance of the system.