Given four points, check whether they form Pythagorean Quadruple.
It is defined as a tuple of integers a, b, c, d such that . They are basically the solutions of Diophantine Equations. In the geometric interpretation it represents a cuboid with integer side lengths |a|, |b|, |c| and whose space diagonal is |d| .
The cuboids sides shown here are examples of pythagorean quadruples.
It is primitive when their greatest common divisor is 1. Every Pythagorean quadruple is an integer multiple of a primitive quadruple. We can generate the set of primitive pythagorean quadruples for which a is odd can be generated by formula :
a = m2 + n2 – p2 – q2,
b = 2(mq + np),
c = 2(nq – mp),
d = m2 + n2 + p2 + q2
where m, n, p, q are non-negative integers with greatest common divisor 1 such that m + n + p + q are odd. Thus, all primitive Pythagorean quadruples are characterized by Lebesgue’s identity.
(m2 + n2 + p2 + q2)2 = (2mq + 2nq)2 + 2(nq – mp)2 + (m2 + n2 – p2 – q2)m2 + n2 – p2 – q2
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.
- Check if given polygon is a convex polygon or not
- Minimum points to be selected such that removal of line segments passing through them empties given array
- Minimum distance to visit given K points on X-axis after starting from the origin
- Area of the largest rectangle formed by lines parallel to X and Y axis from given set of points
- Area of the largest rectangle possible from given coordinates
- Count squares of unique dimensions possible from given Straight Lines parallel to the axes
- Polygon with maximum sides that can be inscribed in an N-sided regular polygon
- Program to find all possible triangles having same Area and Perimeter
- Count number of triangles cut by the given horizontal and vertical line segments
- Count rectangles generated in a given rectangle by lines drawn parallel to X and Y axis from a given set of points
- Generate all integral points lying inside a rectangle
- Count squares possible from M and N straight lines parallel to X and Y axis respectively
- Minimize steps defined by a string required to reach the destination from a given source
- Largest area in a grid unbounded by towers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vt_m