3

New on Tex, LaTex. Hoping this is not a difficult question:

This is the LaTex for the quadratic equation formula:

$$\begin{array}{*{20}c} {x = \frac{{ - b \pm \sqrt {b^2 - 4ac} }}{{2a}}} & {{\rm{when}}} & {ax^2 + bx + c = 0} \\ \end{array}$$

How to I separate this between Delta and X in a way I have also x', x''?

Edit: This a visual approach of what I am looking for:

enter image description here

Thanks

RollRoll
  • 133
  • 1
  • 5
  • Welcome to the TEX.SE community. I have deleted my answer: \rm it is a old command. After I suggest you to this link: https://tex.stackexchange.com/questions/503/why-is-preferable-to/69854 – Sebastiano Jul 13 '20 at 11:31
  • There are many ways to create your image but the user @oliversm has been great. You not choose my answer...I write truly . – Sebastiano Jul 13 '20 at 11:47

2 Answers2

6

For the Delta and X there is no need for any particular alignment, so I think gather is what you want here. Whereas for x' and x'' you want align. Also, for big fractions you want to display, use dfrac (from amsmath), and for some short bits of text between equations, use shortintertext from mathtools).

\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
For a quadratic with determinant $ \Delta $ where
\begin{gather}
\Delta = b^2 - 4ac, \\
\shortintertext{we have the general solution}
x = \dfrac{-b \pm \sqrt{\Delta}}{2a}.
\end{gather}
This has the two roots $ x' $ and $ x'' $ given by
\begin{align}
x'  & = \dfrac{-b + \sqrt{\Delta}}{2a} \\
\shortintertext{and}
x'' & = \dfrac{-b - \sqrt{\Delta}}{2a}. 
\end{align}
\end{document}

enter image description here

As an aside, consider using x^+ and x^- instead of the prime notation, as it makes things clearer, as people will think you're talking about derivatives.

oliversm
  • 2,717
3

I hope that this is ok:

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}

\begin{document} [\begin{matrix} \Delta =b^2-4ac\ x = \dfrac{- b\pm\sqrt{b^2- 4ac}}{2a}\[.5em] x' = \dfrac{- b+\sqrt{b^2- 4ac}}{2a}\[.5em] x'' = \dfrac{- b-\sqrt{b^2- 4ac}}{2a} \end{matrix}] \end{document}

Using the \cdot:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}

\begin{document} [\begin{matrix} \Delta =b^2-4\cdot a\cdot c\ x = \dfrac{- b\pm\sqrt{b^2- 4ac}}{2\cdot a}\[.5em] x' = \dfrac{- b+\sqrt{b^2- 4ac}}{2\cdot a}\[.5em] x'' = \dfrac{- b-\sqrt{b^2- 4ac}}{2\cdot a} \end{matrix}] \end{document}

enter image description here

Sebastiano
  • 54,118
  • 2
    Is there a reason to use matrix instead of gather*? – Teepeemm Jul 14 '20 at 02:39
  • @Teepeemm Very kind Teepeemm I have seen only the original code that there is an array and I have thinked to use a matrix considering that the user was a newbie with LaTeX(TeX). Just it only this the reason. If you see my 2nd comment I have written "there are many ways to create your image" and I have written that the user @oliversm has been great...and I not want that the user check my answer. – Sebastiano Jul 14 '20 at 07:30