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
- Number of triangles that can be formed
- Angle subtended by an arc at the centre of a circle
- C++ Program to Illustrate Trigonometric functions
- Maximum number of line intersections formed through intersection of N planes
- Check if two given Circles are Orthogonal or not
- Program to calculate area of a rhombus whose one side and diagonal are given
- Find the maximum possible distance from origin using given points
- Check if a right-angled triangle can be formed by moving any one of the coordinates
- Program to find Area of Triangle inscribed in N-sided Regular Polygon
- Count number of pairs of lines intersecting at a Point
- Maximum number of region in which N non-parallel lines can divide a plane
- Check whether two points (x1, y1) and (x2, y2) lie on same side of a given line or not
- Find the area of quadrilateral when diagonal and the perpendiculars to it from opposite vertices are given
- Find the diagonal of the Cube
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