Optimal control of systems governed by some elliptic equations