**Problem –** Find the vertex, focus and directrix of a parabola when the coefficients of its equation are given.

A set of points on a plain surface that forms a curve such that any point on that curve is equidistant from the focus is a **parabola.**

**Vertex** of a parabola is the coordinate from which it takes the sharpest turn whereas a is the straight line used to generate the curve.

The standard form of a parabola equation is . Given the values of a, b and c; our task is to find the coordinates of vertex, focus and the equation of the directrix.

**Example –**

Input : 5 3 2 Output : Vertex:(-0.3, 1.55) Focus: (-0.3, 1.6) Directrix: y=-198 Consult the formula below for explanation.

This problem is a simple example of implementations of formulae. Given below are the required set of formulae which will help us tackle the problem.

For a parabola in the form Vertex: Focus: Directrix:

## C++

`#include <iostream> ` `using` `namespace` `std; ` ` ` `// Function to calculate Vertex, Focus and Directrix ` `void` `parabola(` `float` `a, ` `float` `b, ` `float` `c) ` `{ ` ` ` `cout << ` `"Vertex: ("` `<< (-b / (2 * a)) << ` `", "` ` ` `<< (((4 * a * c) - (b * b)) / (4 * a)) ` ` ` `<< ` `")"` `<< endl; ` ` ` `cout << ` `"Focus: ("` `<< (-b / (2 * a)) << ` `", "` ` ` `<< (((4 * a * c) - (b * b) + 1) / (4 * a)) ` ` ` `<< ` `")"` `<< endl; ` ` ` `cout << ` `"Directrix: y="` ` ` `<< c - ((b * b) + 1) * 4 * a << endl; ` `} ` ` ` `// Driver Function ` `int` `main() ` `{ ` ` ` `float` `a = 5, b = 3, c = 2; ` ` ` `parabola(a, b, c); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find the vertex, ` `// focus and directrix of a parabola ` ` ` `class` `GFG { ` ` ` ` ` `// Function to calculate Vertex, ` ` ` `// Focus and Directrix ` ` ` `static` `void` `parabola(` `float` `a, ` ` ` `float` `b, ` `float` `c) ` ` ` `{ ` ` ` ` ` `System.out.println(` `"Vertex: ("` `+ ` ` ` `(-b / (` `2` `* a)) + ` `", "` `+ ` ` ` `(((` `4` `* a * c) - (b * b)) / ` ` ` `(` `4` `* a)) + ` `")"` `); ` ` ` ` ` `System.out.println(` `"Focus: ("` `+ ` ` ` `(-b / (` `2` `* a)) + ` `", "` `+ ` ` ` `(((` `4` `* a * c) - (b * b) + ` `1` `) / ` ` ` `(` `4` `* a)) + ` `")"` `); ` ` ` ` ` `System.out.println(` `"Directrix:"` `+ ` `" y="` `+ ` ` ` `(` `int` `)(c - ((b * b) + ` `1` `) * ` ` ` `4` `* a)); ` ` ` `} ` ` ` ` ` `// Driver Function ` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` `float` `a = ` `5` `, b = ` `3` `, c = ` `2` `; ` ` ` ` ` `// Function calling ` ` ` `parabola(a, b, c); ` ` ` `} ` `} ` ` ` `// This code is contributed by ` `// Smitha Dinesh Semwal ` |

*chevron_right*

*filter_none*

## Python 3

`# Function to calculate Vertex, ` `# Focus and Directrix ` `def` `parabola(a, b, c): ` ` ` ` ` `print` `(` `"Vertex: ("` `, (` `-` `b ` `/` `(` `2` `*` `a)), ` ` ` `", "` `, (((` `4` `*` `a ` `*` `c) ` `-` `(b ` `*` `b)) ` ` ` `/` `(` `4` `*` `a)), ` `")"` `, sep ` `=` `"") ` ` ` ` ` `print` `(` `"Focus: ("` `, (` `-` `b ` `/` `(` `2` `*` `a)), ` ` ` `", "` `, (((` `4` `*` `a ` `*` `c) ` `-` `(b ` `*` `b) ` `+` `1` `) ` ` ` `/` `(` `4` `*` `a)), ` `")"` `, sep ` `=` `"") ` ` ` ` ` `print` `(` `"Directrix: y="` `, c ` `-` `((b ` `*` `b) ` ` ` `+` `1` `) ` `*` `4` `*` `a, sep ` `=` `"") ` ` ` `# Driver Function ` `a ` `=` `5` `b ` `=` `3` `c ` `=` `2` `parabola(a, b, c) ` ` ` `# This code is contributed by Smitha. ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find the vertex, ` `// focus and directrix of a parabola ` `using` `System; ` ` ` `class` `GFG { ` ` ` ` ` `// Function to calculate Vertex, ` ` ` `// Focus and Directrix ` ` ` `static` `void` `parabola(` `float` `a, ` ` ` `float` `b, ` `float` `c) ` ` ` `{ ` ` ` `Console.WriteLine(` `"Vertex: ("` `+ ` ` ` `(-b / (2 * a)) + ` `", "` `+ ` ` ` `(((4 * a * c) - (b * b)) / ` ` ` `(4 * a)) + ` `")"` `); ` ` ` ` ` `Console.WriteLine(` `"Focus: ("` `+ ` ` ` `(-b / (2 * a)) + ` `", "` `+ ` ` ` `(((4 * a * c) - (b * b) + 1) / ` ` ` `(4 * a)) + ` `")"` `); ` ` ` ` ` `Console.Write(` `"Directrix:"` `+ ` `" y="` `+ ` ` ` `(` `int` `)(c - ((b * b) + 1) * 4 * a)); ` ` ` `} ` ` ` ` ` `// Driver Function ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `float` `a = 5, b = 3, c = 2; ` ` ` ` ` `// Function calling ` ` ` `parabola(a, b, c); ` ` ` `} ` `} ` ` ` `// This code is contributed by nitin mittal ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to Find the vertex, ` `// focus and directrix of a parabola ` ` ` `// Function to calculate Vertex, ` `// Focus and Directrix ` `function` `parabola(` `$a` `, ` `$b` `, ` `$c` `) ` `{ ` ` ` ` ` `echo` `"Vertex: ("` `, (-` `$b` `/ (2 * ` `$a` `)) , ` `", "` `, ` ` ` `(((4 * ` `$a` `* ` `$c` `) - (` `$b` `* ` `$b` `)) / (4 * ` `$a` `)), ` ` ` `")"` `, ` `"\n"` `; ` ` ` `echo` `"Focus: ("` `, (-` `$b` `/ (2 * ` `$a` `)) , ` `", "` `, ` ` ` `(((4 * ` `$a` `* ` `$c` `) - (` `$b` `* ` `$b` `) + 1) / (4 * ` `$a` `)) ` ` ` `, ` `")"` `,` `" \n"` `; ` ` ` `echo` `"Directrix: y="` `, ` ` ` `$c` `- ((` `$b` `* ` `$b` `) + 1) * 4 * ` `$a` `; ` `} ` ` ` ` ` `// Driver Code ` ` ` `$a` `= 5; ` `$b` `= 3; ` `$c` `= 2; ` ` ` `parabola(` `$a` `, ` `$b` `, ` `$c` `); ` ` ` `// This code is contributed by vt_m. ` `?> ` |

*chevron_right*

*filter_none*

**Output –**

Vertex:(-0.3, 1.55) Focus: (-0.3, 1.6) Directrix: y=-198

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.

## Recommended Posts:

- Equation of parabola from its focus and directrix
- Equation of ellipse from its focus, directrix, and eccentricity
- Check if every vertex triplet in graph contains two vertices connected to third vertex
- Find the vertex diagonally opposite to the vertex M from an N-sided polygon
- Satisfy the parabola when point (A, B) and the equation is given
- Check if a point is inside, outside or on the parabola
- Make a tree with n vertices , d diameter and at most vertex degree k
- Length of diagonals of a Rhombus using length of Side and vertex Angle
- Find the cordinates of the fourth vertex of a rectangle with given 3 vertices
- Maximum number of edges that N-vertex graph can have such that graph is Triangle free | Mantel's Theorem
- Minimum Manhattan distance covered by visiting every coordinates from a source to a final vertex
- Missing vertex among N axis-parallel rectangles
- Possible number of Trees having N vertex
- Finding n-th number made of prime digits (2, 3, 5 and 7) only
- Finding all subsets of a given set in Java
- Stein's Algorithm for finding GCD
- Finding number of digits in n'th Fibonacci number
- Finding sum of digits of a number until sum becomes single digit
- Finding LCM of more than two (or array) numbers without using GCD
- Finding 'k' such that its modulus with each array element is same

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.