- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# C/C++ Program for Finding the vertex, focus and directrix of the parabola?

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

The general equation for the parabola is

y = ax^{2}+ bx + c

**The 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.

**Focus** is the point with is equidistant from all points of the parabola.

Here, we will find the vertex, focus, and directrix of a parabola. There is a mathematical formula that finds all these values. And we will make a program using the mathematical formula for it.

Input: a = 10, b = 5, c = 4 Output: The vertex: (-0.25, 3.375) The Focus: (-0.25, 3.4) y-Directrix:-1036

## Explanation

The mathematical formula for find the vertex, focus and y-direction from the given values of the parabolic figure.

**Vertex = {(-b/2a) , (4ac-b ^{2}/4a)}**

**Focus = {(-b/2a), (4ac-b ^{2}+1/4a)}**

**Direction = c - (b ^{2} +1)*4a**

## Example

#include <iostream> using namespace std; int main() { float a = 10, b = 5, c = 4; cout << "The vertex: (" << (-b / (2 * a)) << ", " << (((4 * a * c) - (b * b)) / (4 * a)) << ")\n"; cout << "The Focus: (" << (-b / (2 * a)) << ", " << (((4 * a * c) - (b * b) + 1) / (4 * a)) << ")\n"; cout << "y-Directrix:" << c - ((b * b) + 1) * 4 * a; }

- Related Questions & Answers
- C/C++ Program for Finding the vertex, focus and directrix of a parabola?
- Python Program for Finding the vertex, focus and directrix of a parabola
- Finding the vertex, focus and directrix of a parabola in C++
- Finding the vertex, focus and directrix of a parabola in Python Program
- C++ program to find the vertex, focus and directrix of a parabola
- Java Program to find the vertex, focus and directrix of a parabola
- C++ Program to Find the Vertex Connectivity of a Graph
- Finding the path from one vertex to rest using BFS in C++
- C/C++ Program for Finding the Number Occurring Odd Number of Times?
- Golang program to calculate the absolute and scale of a vertex.
- Pendent Vertex, Isolated Vertex and Adjacency of a graph
- Program to find out the minimum cost path between the lowest value vertex to the highest value vertex (Python)
- C++ Program to Implement a Heuristic to Find the Vertex Cover of a Graph
- Program to calculate vertex-to-vertex reachablity matrix in Python
- Cut Set and Cut Vertex of Graph