Given a straight line with equation coefficients as a, b & c(ax + by + c = 0), the task is to find the area of the triangle formed by the axes of co-ordinates and this straight line.
Input: a = -2, b = 4, c = 3 Output: 0.5625 Input: a = 4, b = 3, c = 12 Output: 6
- Let PQ be the straight line having AB, the line segment between the axes.
The equation is,
ax + by + c = 0
- so, in intercept form it can be expressed as,
x/(-c/a) + y/(-c/b) = 1
- So, the x-intercept = -c/a
the y-intercept = -c/b
- So, it is very clear now the base of the triangle AOB will be -c/a
and the base of the triangle AOB will be -c/b
- So, area of the triangle
Below is the implementation of the above approach:
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 whether a straight line can be formed using N co-ordinate points
- Find the coordinates of a triangle whose Area = (S / 2)
- Check if a right-angled triangle can be formed by the given coordinates
- Check if a right-angled triangle can be formed by moving any one of the coordinates
- Equation of straight line passing through a given point which bisects it into two equal line segments
- Straight-line Number
- Represent a given set of points by the best possible straight line
- Length of the normal from origin on a straight line whose intercepts are given
- Find coordinates of the triangle given midpoint of each side
- Program to find the Type of Triangle from the given Coordinates
- Puzzle | Place numbers 1 to 9 in a Circle such that sum of every triplet in straight line is 15
- Find minimum area of rectangle with given set of coordinates
- Area of Reuleaux Triangle
- Area of a Triangle from the given lengths of medians
- Area of Circumcircle of a Right Angled Triangle
- Area of Incircle of a Right Angled Triangle
- Area of a triangle inside a parallelogram
- Program to find area of a triangle
- Check if right triangle possible from given area and hypotenuse
- Maximum number of line intersections formed through intersection of N planes
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.