# 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!
Either the primal variable is zero, or the associated dual constraint is tight: $${x^*_j = 0 \textrm{ or } \sum_{i=1}^m a_{ij}y^*_i = c_j \textrm{ (or both) for } j=1,2,\ldots,n}$$ Either the primal constraint is tight, or the associated dual variable is zero: $$\label{eq:CSC:2} {\sum_{j=1}^n a_{ij}x^*_j = b_i \textrm{ or } y^*_i = 0 \textrm{ (or both) for } i=1,2,\ldots,m}$$
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.