A geometric approach to the method of Lagrange multipliers is presented using the framework of the tangent bundle geometry. The nonholonomic systems with constraint functions linear in the velocities are studied in the first place and then, and using this study of the nonholonomic mechanical systems as a previous result, the holonomic systems are considered. The Lagrangian inverse problem is also analysed and, finally, the theory is illustrated with several examples.