Quadratic Formula

2022/3/28 6:25:50

本文主要是介绍Quadratic Formula,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Quadratic Formula:

The quadratic equation is as follows:

$ax^2+bx+c=0$

The quadratic formula tells us that the solutions to this equation is 

$x = \frac{-b\pm\sqrt{b^2-4ac}}{2a}$

So let's apply it to some problem.

Let's start off with something that we could have factored just to verify that it's giving us the same answer.

Example 1:

$x^2+4x-21=0$

$a=1, b=4, c=-21$

$x = \frac{-4\pm\sqrt{4^2-4\cdot1\cdot(-21)}}{2\cdot1}$

$x=\frac{-4\pm\sqrt{16+84}}{2}$

$x=\frac{-4\pm\sqrt{100}}{2}$

$x=\frac{-4\pm10}{2}$

$x=-2\pm5$

So: $x=3$ or $x=-7$

Sothe quadratic formula seems to have given us an answer for this. You can verify just by substituting back in that these do work.

$(x+7)\cdot(x-3)=0$

$x+7=0$ or $x-3=0$

$x=-7$ or $x=3$

Example 2:(no real solutions)

$3x^2+6x+10=0$ $a=3, b=6, c=10$ $x=\frac{-6\pm\sqrt{6^2-4\cdot3\cdot10}}{2\cdot3}$ $x=\frac{-6\pm\sqrt{36-120}}{6}$ $x=\frac{-6\pm\sqrt{-84}}{6}$ It jus gives us a square root of a negative number. It means this will have no real solutions.

Example 3:(not so obvious to factor)

$-3x^2+12x+1=0$ $a=-3, b=12, c=1$ $x=\frac{-12\pm\sqrt{12^2-4\cdot(-3)\cdot1}}{2\cdot(-3)}$ $x=\frac{-12\pm\sqrt{144+12}}{-6}$ $x=\frac{-12\pm\sqrt{156}}{-6}$ $\because156=2\cdot78=2\cdot2\cdot39$ $\therefore\sqrt{156}=\sqrt{2\cdot2\cdot39}=\sqrt{2\cdot2}\cdot\sqrt{39}=2\sqrt{39}$ $x=\frac{-12\pm2\sqrt{39}}{-6}$ $x=\frac{-6\pm\sqrt{39}}{-3}$ $x=\frac{-6}{-3}\pm\frac{\sqrt{39}}{-3}$ $x=2\pm\frac{\sqrt{39}}{-3}$ $x=2\pm\frac{\sqrt{39}}{3}$

Proof of the quadratic formula:

The quadratic equation is as following:

$ax^2+bx+c=0$   $(a>0)$

Dividing everything by a and you got :

$x^2+\frac{b}{a}x+\frac{c}{a}=0$

$x^2+\frac{b}{a}x=-\frac{c}{a}$

Let's complete the square, just take $\frac12$ of coefficient on the x term and square it as following:

$x^2+\frac{b}{a}x+(\frac{b}{2a})^2=-\frac{c}{a}+(\frac{b}{2a})^2$

$(x+\frac{b}{2a})^2=-\frac{c}{a}+(\frac{b}{2a})^2$

$(x+\frac{b}{2a})^2=-\frac{c}{a}+\frac{b^2}{4a^2}$

$(x+\frac{b}{2a})^2=\frac{b^2}{4a^2}-\frac{c}{a}$

$(x+\frac{b}{2a})^2=\frac{b^2}{4a^2}-\frac{4ac}{4a^2}$

$(x+\frac{b}{2a})^2=\frac{b^2 - 4ac}{4a^2}$

$x+\frac{b}{2a}=\pm\sqrt\frac{b^2 - 4ac}{4a^2}$

$x+\frac{b}{2a}=\pm\frac{\sqrt{b^2 - 4ac}}{2a}$

$x=-\frac{b}{2a}\pm\frac{\sqrt{b^2 - 4ac}}{2a}$

$x=\frac{-b}{2a}\pm\frac{\sqrt{b^2 - 4ac}}{2a}$

$x=\frac{{-b}\pm{\sqrt{b^2 - 4ac}}}{2a}$

  References: The quadratic formula Proof of the quadratic formula

这篇关于Quadratic Formula的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程