In this paper, we consider an optimal control problem for an elliptic obstacle problem. Using a family of semi-linear elliptic partial differential equations to approximate the obstacle problem, we obtain an approximate optimal problem for partial differential equations. Then, we propose a new method to prove the objective functional in the approximate optimal problem is Gâteaux-differentiable and compute its gradient. The gradient descent algorithm and Gauss Newton algorithm are presented to find the numerical solution. Numerical ...