** Problem:** Given 3 points

**a**,

**b**,

**c**, the task is to check if these three points are collinear.

** Explanation:** An instance of the problem is an input specified to the problem. An instance of the collinearity problem is three points

**((a**. Since an NP-Complete is a problem which is both in

_{x}, a_{y}), (b_{x}, b_{y}), (c_{x}, c_{y}))**NP**and

**NP-hard**, the proof for the statement that a problem is NP-Complete consists of two parts:

- The problem itself is in NP class.
- All other problems in NP class can be polynomial-time reducible to that.

(B is polynomial-time reducible to C is denoted as B ≤ P^{C})

If the 2nd condition is only satisfied then the problem is called **NP-Hard**.

But it is not possible to reduce every NP problem into another NP problem to show its NP-Completeness all the time. That is why to show a problem is NP-complete, prove that the problem is in NP and any NP-Complete problem is reducible to that. Thus, it can be verified that the collinearity problem is NP-Complete using the following propositions:

__Collinearity Problem is in NP__:

If any problem is in NP, then given a ‘certificate’, which is a solution to the problem and an instance of the problem (a collection of three points **a**, **b**, **c**) we will be able to identify(whether the solution is correct or not) certificate in polynomial time. This can be done by checking:

__Collinearity problem is NP-Hard__:

In order to prove the Collinearity problem is NP-Hard, deduce a reduction from a known NP-Hard problem, that is, 3-Sum to collinearity problem. For each **x** in the 3-Sum instance, map from **x** to **(x, x ^{3})**. Now, from 3 Sum instances

**(x, y, z)**we have

**((x, x**.

^{3}), (y, y^{3}), (z, z^{3}))The following propositions hold:

Let set **S** has collinear points **(x, x ^{3}), (y, y^{3}), (z, z^{3})**

Now,

=>

=>

=>

=>

=>

Therefore, (x, y, z) are collinear points. These equations are interchangeable.

Therefore, the **Collinearity Problem** is **NP-Complete**.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer **Complete Interview Preparation Course****.**

In case you wish to attend live classes with industry experts, please refer **DSA Live Classes**