Cost minimization is a necessary (but not sufficient) condition for profit maximization. Even when a producer is not a price taker in the output market, or when the solution to the profit maximization problem is not well defined (say, due to increasing returns), the producer must still minimize costs.
The producer chooses x1 and x2 (the choice variables) to minimize C(x1,x2) (the objective function)
minimize C(x1,x2) = w1 x1 + w2 x2
subject to the constraint
f(x1,x2) = y
The parameters of this problem are w1, w2, and y.
Form the Lagrangian function:
L = w1 x1 + w2 x2 + λ ( y - f(x1,x2) )
The variable λ is called the Lagrange multiplier for the constraint.