# How obtain the dual variables' value given a primal solution

I am currently studying duality theory (for linear programming) and stumbled upon some confusion. Duality theory provides a useful tool to check if a given primal solution is optimal. A given primal solution is optimum iff the corresponding dual solution is feasible. Now, I want to check whether my solution for my primal is optimal without having to solve it using the simplex method. I can write the corresponding dual formulation, but I don't see how to obtain the corresponding dual variables from a primal solution to check for a violated dual constraint?

• Have a look at this answer, especially point number 2 – David M. Jun 13 '18 at 16:53
• Also, what do you mean by "the corresponding dual solution"? – David M. Jun 13 '18 at 16:54
• 1. get the basis. 2. calculate $\pi^T = c_B^T B^{-1}$ – Erwin Kalvelagen Jun 14 '18 at 0:25

Now given a solution $x^*$, use the complementary slackness theorem!
If your solution $x^*$ is basic, you should find yourself with a system of equations with $n$ equations and $n$ unknowns. Solving it will give you a dual solution. If it is feasible on the dual, $x^*$ is optimal.