Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Practice Mathematical Algorithm
  • Mathematical Algorithms
  • Pythagorean Triplet
  • Fibonacci Number
  • Euclidean Algorithm
  • LCM of Array
  • GCD of Array
  • Binomial Coefficient
  • Catalan Numbers
  • Sieve of Eratosthenes
  • Euler Totient Function
  • Modular Exponentiation
  • Modular Multiplicative Inverse
  • Stein's Algorithm
  • Juggler Sequence
  • Chinese Remainder Theorem
  • Quiz on Fibonacci Numbers
Open In App
Next Article:
Find the equation of plane which passes through two points and parallel to a given axis
Next article icon

Find the equation of plane which passes through two points and parallel to a given axis

Last Updated : 27 Mar, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Given two points A(x1, y1, z1) and B(x2, y2, z2) and a set of points (a, b, c) which represent the axis (ai + bj + ck), the task is to find the equation of plane which passes through the given points A and B and parallel to the given axis.

Examples: 

Input: x1 = 1, y1 = 2, z1 = 3, x2 = 3, y2 = 4, z2 = 5, a= 6, b = 7, c = 8 
Output: 2x + 4y + 2z + 0 = 0 

Input: x1 = 2, y1 = 3, z1 = 5, x2 = 6, y2 = 7, z2 = 8, a= 11, b = 23, c = 10. 
Output: -29x + 7y + 48z + 0= 0 

Approach: 
From the given two points on plane A and B, The directions ratios a vector equation of line AB is given by:  

direction ratio = (x2 - x1, y2 - y1, z2 - z1) 

\overrightarrow{AB} = (x2-x1) i + (y2-y1) j + (z2 - z1) k     

Since the line 

\overrightarrow{AB}          
 

is parallel to the given axis 


(ai + bj + ck)          
 

. Therefore, the cross-product of 


\overrightarrow{AB}          
 

and 


(ai + bj + ck)          
 

is 0 which is given by: 

\begin{vmatrix} i & j & k\\ d & e & f \\ a & b & c \end{vmatrix} = 0          
 

where, 
d, e, and f are the coefficient of vector equation of line AB i.e., 
d = (x2 - x1), 
e = (y2 - y1), and 
f = (z2 - z1) 
and a, b, and c are the coefficient of given axis. 

The equation formed by the above determinant is given by:  

(b*f - c*e) i - (a * f - c * d) j + (a * e - b * d) k = 0          
 

(Equation 1) 


 

Equation 1 is perpendicular to the line AB which means it is perpendicular to the required plane. 
Let the Equation of the plane is given by 
Ax + By + Cz = D          
(Equation 2) 
where A, B, and C are the direction ratio of the plane perpendicular to the plane.
Since Equation 1 is Equation 2 are perpendicular to each other, therefore the value of the direction ratio of Equation 1 & 2 are parallel. Then the coefficient of the plane is given by:   

A = (b*f - c*e), 
B = (a*f - c*d), and 
C = (a*e - b*d) 

Now dot product of plane and vector line AB gives the value of D as  

D = -(A * d – B * e + C * f)  

Below is the implementation of the above approach: 

C++
// C++ implementation to find the // equation of plane which passes // through two points and parallel // to a given axis  #include <bits/stdc++.h> using namespace std;  void findEquation(int x1, int y1, int z1,                   int x2, int y2, int z2,                   int d, int e, int f) {      // Find direction vector     // of points (x1, y1, z1)     // and (x2, y2, z2)     double a = x2 - x1;     double b = y2 - y1;     double c = z2 - z1;      // Values that are calculated     // and simplified from the     // cross product     int A = (b * f - c * e);     int B = (a * f - c * d);     int C = (a * e - b * d);     int D = -(A * d - B * e + C * f);      // Print the equation of plane     cout << A << "x + " << B << "y + "          << C << "z + " << D << "= 0"; }  // Driver Code int main() {      // Point A     int x1 = 2, y1 = 3, z1 = 5;      // Point B     int x2 = 6, y2 = 7, z2 = 8;      // Given axis     int a = 11, b = 23, c = 10;      // Function Call     findEquation(x1, y1, z1,                  x2, y2, z2,                  a, b, c);      return 0; } 
Java
// Java implementation to find the  // equation of plane which passes  // through two points and parallel  // to a given axis  import java.util.*;   class GFG{   static void findEquation(int x1, int y1, int z1,                           int x2, int y2, int z2,                           int d, int e, int f)  {          // Find direction vector      // of points (x1, y1, z1)      // and (x2, y2, z2)      double a = x2 - x1;      double b = y2 - y1;      double c = z2 - z1;       // Values that are calculated      // and simplified from the      // cross product      int A = (int)(b * f - c * e);      int B = (int)(a * f - c * d);      int C = (int)(a * e - b * d);      int D = -(int)(A * d - B * e + C * f);       // Print the equation of plane      System.out.println(A + "x + " + B + "y + " +                         C + "z + " + D + "= 0 ");  }   // Driver code  public static void main(String[] args)  {       // Point A      int x1 = 2, y1 = 3, z1 = 5;       // Point B      int x2 = 6, y2 = 7, z2 = 8;       // Given axis      int a = 11, b = 23, c = 10;       // Function Call      findEquation(x1, y1, z1,                   x2, y2, z2,                   a, b, c);  }  }   // This code is contributed by Pratima Pandey  
Python3
# Python3 implementation  # to find the equation  # of plane which passes # through two points and  # parallel to a given axis def findEquation(x1, y1, z1,                  x2, y2, z2,                  d, e, f):        # Find direction vector     # of points (x1, y1, z1)     # and (x2, y2, z2)     a = x2 - x1     b = y2 - y1     c = z2 - z1      # Values that are calculated     # and simplified from the     # cross product     A = (b * f - c * e)     B = (a * f - c * d)     C = (a * e - b * d)     D = -(A * d - B *            e + C * f)      # Print the equation of plane     print (A, "x + ", B, "y + ",             C, "z + ", D, "= 0")  # Driver Code if __name__ == "__main__":        # Point A     x1 = 2     y1 = 3     z1 = 5;      # Point B     x2 = 6     y2 = 7     z2 = 8      # Given axis     a = 11     b = 23     c = 10      # Function Call     findEquation(x1, y1, z1,                  x2, y2, z2,                  a, b, c)  # This code is contributed by Chitranayal 
C#
// C# implementation to find the  // equation of plane which passes  // through two points and parallel  // to a given axis  using System; class GFG{   static void findEquation(int x1, int y1, int z1,                           int x2, int y2, int z2,                           int d, int e, int f)  {          // Find direction vector      // of points (x1, y1, z1)      // and (x2, y2, z2)      double a = x2 - x1;      double b = y2 - y1;      double c = z2 - z1;       // Values that are calculated      // and simplified from the      // cross product      int A = (int)(b * f - c * e);      int B = (int)(a * f - c * d);      int C = (int)(a * e - b * d);      int D = -(int)(A * d - B * e + C * f);       // Print the equation of plane      Console.Write(A + "x + " + B + "y + " +                    C + "z + " + D + "= 0 ");  }   // Driver code  public static void Main()  {       // Point A      int x1 = 2, y1 = 3, z1 = 5;       // Point B      int x2 = 6, y2 = 7, z2 = 8;       // Given axis      int a = 11, b = 23, c = 10;       // Function Call      findEquation(x1, y1, z1,                   x2, y2, z2,                   a, b, c);  }  }   // This code is contributed by Code_Mech 
JavaScript
<script> // javascript implementation to find the  // equation of plane which passes  // through two points and parallel  // to a given axis       function findEquation(x1 , y1 , z1 , x2 , y2 , z2 , d , e , f)     {          // Find direction vector         // of points (x1, y1, z1)         // and (x2, y2, z2)         var a = x2 - x1;         var b = y2 - y1;         var c = z2 - z1;          // Values that are calculated         // and simplified from the         // cross product         var A = parseInt( (b * f - c * e));         var B = parseInt( (a * f - c * d));         var C = parseInt( (a * e - b * d));         var D = -parseInt( (A * d - B * e + C * f));          // Print the equation of plane         document.write(A + "x + " + B + "y + " + C + "z + " + D + "= 0 ");     }      // Driver code              // Point A         var x1 = 2, y1 = 3, z1 = 5;          // Point B         var x2 = 6, y2 = 7, z2 = 8;          // Given axis         var a = 11, b = 23, c = 10;          // Function Call         findEquation(x1, y1, z1, x2, y2, z2, a, b, c);  // This code is contributed by Rajput-Ji </script> 

Output: 
-29x + 7y + 48z + 0= 0

 

Time Complexity: O(1)

Auxiliary Space: O(1)


Next Article
Find the equation of plane which passes through two points and parallel to a given axis

Y

yogesh shukla 1
Improve
Article Tags :
  • Misc
  • Mathematical
  • Geometric
  • DSA
Practice Tags :
  • Geometric
  • Mathematical
  • Misc

Similar Reads

    Program to find equation of a plane passing through 3 points
    Given three points (x1, y1, z1), (x2, y2, z2), (x3, y3, z3). The task is to find the equation of the plane passing through these 3 points. Examples: Input: x1 = -1 y1 = w z1 = 1 x2 = 0 y2 = -3 z2 = 2 x3 = 1 y3 = 1 z3 = -4 Output: equation of plane is 26 x + 7 y + 9 z + 3 = 0.Input: x1 = 2, y1 = 1, z
    10 min read
    Equation of straight line passing through a given point which bisects it into two equal line segments
    Given a straight line which passes through a given point (x0, y0) such that this point bisects the line segment in two equal line segments. The task is to find the equation of this straight line.Examples: Input: x0 = 4, y0 = 3 Output: 3x + 4y = 24Input: x0 = 7, y0 = 12 Output: 12x + 7y = 168 Approac
    4 min read
    Satisfy the parabola when point (A, B) and the equation is given
    Given a point (A, B) such that distance from each point on the curve M.y = N.x2 + O.x + P with (A, B) is equal to the distance between that point on the curve and x-axis. The task is to find the value of M, N O and P. Note: The equation should be in simple form i.e. gcd( |M|, |N|, |O|, |P| ) = 1 and
    4 min read
    Find X and Y intercepts of a line passing through the given points
    Given two points on a 2D plane, the task is to find the x - intercept and the y - intercept of a line passing through the given points.Examples: Input: points[][] = {{5, 2}, {2, 7}} Output: 6.2 10.333333333333334Input: points[][] = {{3, 2}, {2, 4}} Output: 4.0 8.0 Approach: Find the slope using the
    7 min read
    Program to check if the points are parallel to X axis or Y axis
    Given n points, we need to check if these n points are parallel to X axis or Y axis or to No axis. Examples: Input : x[] = {0, 0, 0, 0, 0| y[] = {9, 2, 1, 3, 4} Output : Parallel to Y Axis Input : x[] = {1, 2, 3| y[] = {9, 2, 1} Output : Not Parallel to X or Y Axis Approach To find the points parall
    6 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences