# Learning more about Dual and Primal as used in Zygote.jl

**URL:** https://discourse.julialang.org/t/learning-more-about-dual-and-primal-as-used-in-zygote-jl/134739
**Category:** General Usage
**Created:** [December 26, 2025, 4:58am UTC](https://discourse.julialang.org/t/learning-more-about-dual-and-primal-as-used-in-zygote-jl/134739 "2025-12-26T04:58:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![firebat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/firebat/32/220098_2.png) [@firebat](https://discourse.julialang.org/u/firebat)
#### Post date: [December 26, 2025, 4:58am UTC](https://discourse.julialang.org/t/learning-more-about-dual-and-primal-as-used-in-zygote-jl/134739/1 "2025-12-26T04:58:53Z")

</div>

Hi all, I’ve been interested in learning more about Zygote.jl and some ways I can use it in my optimization programs. Frankly, when terminology such as dual and primal are mentioned in the context of Zygotes mechanism, I don’t really understand their function, let alone the purpose for the implementation of duals and primals in the code. Can someone perhaps give me some direction on where to look for more information on dual and primals?

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [December 26, 2025, 10:14am UTC](https://discourse.julialang.org/t/learning-more-about-dual-and-primal-as-used-in-zygote-jl/134739/2 "2025-12-26T10:14:31Z")

</div>

Welcome to the Julia Forum! 👋

The best starting point is probably: [Duality (optimization) - Wikipedia](https://en.wikipedia.org/wiki/Duality_(optimization)) to the generality you are looking for.

---

<div class="post-metadata">

### Author: ![ForceBru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/forcebru/32/21389_2.png) [@ForceBru](https://discourse.julialang.org/u/ForceBru)
#### Post date: [December 27, 2025, 10:43am UTC](https://discourse.julialang.org/t/learning-more-about-dual-and-primal-as-used-in-zygote-jl/134739/3 "2025-12-27T10:43:05Z")

</div>

Where are you reading about dual and primal stuff? The Zygote documentation doesn’t seem to mention “dual” anywhere: [Search · Zygote](https://fluxml.ai/Zygote.jl/stable/search/?q=dual).

If you search Zygote’s code for “dual”, you’ll get just a few hits, all of which seem to be related to ForwardDiff.jl, dual numbers and forward-mode automatic differentiation. One introduction to dual numbers could be [Automatic Differentiation with Dual Numbers | Alejandro Morales' Blog](https://alemorales.info/post/automatic-differentiation-with-dual-numbers/).

According to [Introduction · ChainRules](https://juliadiff.org/ChainRulesCore.jl/v0.9/), something is “primal” if it refers to the original computation f(x), not its derivatives.
