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的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-13PingCAP 戴涛:构建面向未来的金融核心系统
- 2024-05-09flutter3.x_macos桌面os实战
- 2024-05-09Rust中的并发性:Sync 和 Send Traits
- 2024-05-08使用Ollama和OpenWebUI在CPU上玩转Meta Llama3-8B
- 2024-05-08完工标准(DoD)与验收条件(AC)究竟有什么不同?
- 2024-05-084万 star 的 NocoDB 在 sealos 上一键起,轻松把数据库编程智能表格
- 2024-05-08Mac 版Stable Diffusion WebUI的安装
- 2024-05-08解锁CodeGeeX智能问答中3项独有的隐藏技能
- 2024-05-08RAG算法优化+新增代码仓库支持,CodeGeeX的@repo功能效果提升
- 2024-05-08代码报错不用愁,CodeGeeX一键完成代码修复、错误解释的功能上线了!