There's almost surely a way to do it analytically, but I don't know it. So go read about Solver, and then post back.