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

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

| improve this answer | |
  • 1
    Is there a reason to use matrix instead of gather*? – Teepeemm Jul 14 at 2: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 at 7:30
5

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.