# How to subtract one gaussian from another?

**URL:** <https://root-forum.cern.ch/t/how-to-subtract-one-gaussian-from-another/39229>\
**Category:** Newbie\
**Created:** [May 3, 2020, 3:42pm UTC](https://root-forum.cern.ch/t/how-to-subtract-one-gaussian-from-another/39229 "2020-05-03T15:42:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Va\_Findesiecle](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/va_findesiecle/32/20144_2.png) [@Va\_Findesiecle](https://root-forum.cern.ch/u/Va_Findesiecle)\
**Post date:** [May 3, 2020, 3:42pm UTC](https://root-forum.cern.ch/t/how-to-subtract-one-gaussian-from-another/39229/1 "2020-05-03T15:42:08Z")

</div>

Hello everyone,

I fitted two histos, and now I got two 2d gaussians and i want to subtract one from another. Can somebody explain how to do it? Or should I fill 2 more histos with some data using my fits and than subtract them?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [May 3, 2020, 4:01pm UTC](https://root-forum.cern.ch/t/how-to-subtract-one-gaussian-from-another/39229/2 "2020-05-03T16:01:37Z")

</div>

Try:  
`TF2 *f = new TF2("f", "xygaus(0) - xygaus(5)", 0., 1., 0., 1.); f->Print();`

See:  
`grep -r xygaus ${ROOTSYS}/t[eu]*`
