What is duality? I have seen some examples of duality. Sometimes applied to theorems, as for example Desargues theorem and Pappus theorem. Sometimes applied to spaces, for example the dual space of a vector space. Sometimes even applied to a method like simplex and dual simplex methods in linear programming.
My question is what is the general meaning behind the term duality and what is its relevance to mathematics. Do we mean the same always when we use the term? Or the examples I have put have no connection whatsoever?
Thanks a lot
 A: It is true that "duality" is a quite broad concept in many fields and the field of mathematics is not the exception. For example the Wikipedia website shows many forms of duality in Mathematics.  As mathematicians we want to abstract the meaning of a word into a unique concept that ecompasses all situations.
For duality we need to define two spaces of objects and an attribute (property) of those objects. Then establish a relation between objects of one space and the other thru this attribute. If this relation is unique we say that objects of one space are duals of objects in the other space. This is not anything else that the definition of a bijective function. Any duality in mathematics can be expressed as a bijective function between two spaces of objects. So $a \in A$ is dual of $b \in B$ if there is some relation $f$ such that $b=f(a)$ and $a=f^{-1}(b)$ in a unique way.
Two properties should be always present in a duality:


*

*Symmetry: If $a$ is dual of $b$, $b$ is dual of $a$.

*Idempotence: If $d$ is dual operation then $d^2 = I$.In words, the dual of the dual is the original object.


If the two spaces of objects are the same, the function $f$ described in the first paragraph, at the top ot this post, is idemponent. That is $f^2=I$. Otherwise we need two different functions $f$ and $f^{-1}$ to get back to the starting point. 
For example in linear algebra, in the space of square matrices, the transpose is an idempotent operator and so it is a dual operation which does not exit the space (it is closed). If a matrix is not square, its transpose leaves in a different space and the trasposition function it is not idempotent anymore. This generalizes to functional analysis with the concept of adjoint. In spherical geometry a north pole is a dual of its equator but the objects do not live in the same space: the first are points and the second "lines" in the sphere. But in spherical geometry triangles are dual of polar triangles and they leave in the same space so the duality here is an idempotence.
Please observe that the dual in this discussion can be confused with the concept of inverse and a claritication is needed. In the language of the first paragraph it is,  since we establish a bijection between objects and, by definition of inverse,  duality and inversion are linked together. However it is not an inverse in many respects. In the space of matrices, the transpose is a dual but not an inverse matrix and in general the adjoint is not the inverse for the more general context of functional analysis. Now, if we define a function in the space of square matrices as sending a matrix into its transpose, then the inverse of this function coincides with the concept of dual, but it is not the inverse of the matrix, so by "inverse" we need to be precise of what type of inverse we are looking for.
We then say that duality is a word attached to objects and spaces where those objects leave. We could say that two spaces are dual of each other if there is a bijective function between them. In this sense duality is an equivalence relation:


*

*Reflexive: Every space is dual to itself. The identity function is always a duality.

*Symmetric: If a space $A$ is dual to a space $B$, then a space $B$ is dual to a space $A$. This is by definition since it exist a bijective function between the two spaces.

*Transitive: Function composition of bijective functions.

A: Duality is a very general and broad concept, without a strict definition that captures all those uses. When applied to specific concepts, there usually is a precise definition for just that context. The common idea is that there are two things which basically are just two sides of the same coin.
Common themes in this topic include:


*

*Two different interpretations or descriptions of fundamentally the same structure or object
(e.g. roles of points and lines interchanged, roles of variables in LP changed)

*Primal and dual often are the same kind of object
(e.g. incidence configuration, vector space, linear program, planar graph, …)

*The dual of the dual is again the primal


Not every use of the word strictly satisfies all of these aspects, but the general idea usually is still the same.
A: The concept of duality is broad and universal, and describing how it relates to math will be subjective depending on a chosen philosophical framework. 
You can go to wikepedia and read Duality (mathematics).
Here is my general outlook - there is a duality between logic and mathematical objects/things that the human mind attempts to comprehend.
The most primitive logic is the dual of the Galois field with 2 elements.
Extremely more advanced logic is necessary to understand Galois theory and why it is not possible to construct an angle of 20° with a ruler and compass.

Just for fun, listen to this (offset) youtube clip
Yin & Yang | Universal Duality

I am pleased to observe that you Humans are already manipulating the
  duality of the universe to your advantage, by using the technological
  0 and 1, and the universal duality interpreter known as math.

A: As one wise man once said, "The term duality refers to situations where you have a natural-but-surprising correspondence between two different mathematical objects".
In lineal algebra for example, the dual of a vector is the linear transformation that it 
encodes and the dual of a linear tranformation from a vector space to one dimension is a certain vector in that space.
Hope this helps you understand a little bit more about the concept of duality.
