ArticleslgStudy

mathematics

XOR gate

XOR gate is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand XOR gate rather than just read about it. In short: The XOR gate (sometimes EOR, or EXOR and pronounced as exclusive OR, ksor or sometimes EX-OR) is a digital logic gate that gives a true (1 or HIGH) output when the number of true inputs is odd. An XOR gate implements an exclusive or ( ↮ {\displaystyle \nleftrightarrow } ) from mathematical logic; that is, a true output results if one, and only one, of the inputs to the gate is true.

XOR gate — main illustration
XOR gate — illustration

Key takeaways

  • XOR gate belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect XOR gate to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of XOR gate from memory before moving on to harder problems.

Reference excerpt

The XOR gate (sometimes EOR, or EXOR and pronounced as exclusive OR, ksor or sometimes EX-OR) is a digital logic gate that gives a true (1 or HIGH) output when the number of true inputs is odd. An XOR gate implements an exclusive or ( ↮ {\displaystyle \nleftrightarrow } ) from mathematical logic; that is, a true output results if one, and only one, of the inputs to the gate is true. If both inputs are false (0/LOW) or both are true, a false output results. XOR represents the inequality function, i.e., the output is true if the inputs are not alike otherwise the output is false. A way to remember XOR is "must have one or the other but not both". An XOR gate may serve as a "programmable inverter" in which one input determines whether to invert the other input, or to simply pass it along with no change. Hence it functions as a inverter (a NOT gate) which may be activated or deactivated by a switch. XOR can also be viewed as addition modulo 2. As a result, XOR gates are used to implement binary addition in computers. A half adder consists of an XOR gate and an AND gate. The gate is also used in subtractors and comparators. The algebraic expressions A ⋅ B ¯ + A ¯ ⋅ B {\displaystyle A\cdot {\overline {B}}+{\overline {A}}\cdot B} or ( A + B ) ⋅ ( A ¯ + B ¯ ) {\displaystyle (A+B)\cdot ({\overline {A}}+{\overline {B}})} or ( A + B ) ⋅ ( A ⋅ B ) ¯ {\displaystyle (A+B)\cdot {\overline {(A\cdot B)}}} or A ⊕ B {\displaystyle A\oplus B} all represent the XOR gate with inputs A and B. The behavior of XOR is summarized in the truth table shown on the right.

Symbols There are three schematic symbols for XOR gates: the traditional ANSI and DIN symbols and the IEC symbol. In some cases, the DIN symbol is used with ⊕ instead of ≢. For more information see Logic gate symbols. The "=1" on the IEC symbol indicates that the output is activated by only one active input.

The logic symbols ⊕, Jpq, and ⊻ can be used to denote an XOR operation in algebraic expressions. C-like languages use the caret symbol ^ to denote bitwise XOR. (Note that the caret does not denote logical conjunction (AND) in these languages, despite the similarity of symbol.)

Implementation The XOR gate is most commonly implemented using MOSFETs circuits. Some of those implementations include:

AND-OR-invert XOR gates can be implemented using AND-OR-invert (AOI) or OR-AND-invert (OAI) logic.

CMOS The metal–oxide–semiconductor (CMOS) implementations of the XOR gate corresponding to the AOI logic above are shown below. On the left, the nMOS and pMOS transistors are arranged so that the input pairs A ⋅ B ¯ {\displaystyle A\cdot {\overline {B}}} and A ¯ ⋅ B {\displaystyle {\overline {A}}\cdot B} activate the 2 pMOS transistors of the top left or the 2 pMOS transistors of the top right respectively, connecting Vdd to the output for a logic high. The remaining input pairs A ⋅ B {\displaystyle A\cdot B} and A ¯ ⋅ B ¯ {\displaystyle {\overline {A}}\cdot {\overline {B}}} activate each one of the two nMOS paths in the bottom to Vss for a logic low. If inverted inputs (for example from a flip-flop) are available, this gate can be used directly. Otherwise, two additional inverters with two transistors each are needed to generate A ¯ {\displaystyle {\overline {A}}} and B ¯ {\displaystyle {\overline {B}}} , bringing the total number of transistors to twelve. The AOI implementation without inverted input has been used, for example, in the Intel 386 CPU.

Transmission gates The XOR gate can also be implemented through the use of transmission gates with pass transistor logic.

This implementation uses two transmission gates and two inverters not shown in the diagram to generate A ¯ {\displaystyle {\overline {A}}} and B ¯ {\displaystyle {\overline {B}}} for a total of eight transistors, four less than in the previous design. The XOR function is implemented by passing through to the output the inverted value of A when B is high and passing the value of A when B is at a logic low. so when both inputs are low the transmission gate at the bottom is off and the one at the top is on and lets A through which is low so the output is low. When both are high only the one at the bottom is active and lets the inverted value of A through and since A is high the output will again be low. Similarly if B stays high but A is low the output would be A ¯ {\displaystyle {\overline {A}}} which is high as expected and if B is low but A is high the value of A passes through and the output is high completing the truth table for the XOR gate. The trade-off with the previous implementation is that since transmission gates are not ideal switches, there is resistance associated with them, so depending on the signal strength of the input, cascading them may degrade the output levels.

… excerpt ends here. Continue reading the full article.

Illustrations

XOR gate: XOR Venn diagram
XOR Venn diagram
XOR gate illustration
XOR gate illustration
XOR gate illustration
XOR gate illustration

Worked examples

Example 1 — a first encounter with XOR gate

Start with the simplest possible case. Write down what XOR gate claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to XOR gate before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about XOR gate ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of XOR gate

In research
XOR gate appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses XOR gate in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
XOR gate is common in secondary-school and first-year university syllabi. It links to neighbouring topics Boolean algebra, Digital electronics, Logic gates, so understanding it makes those chapters shorter.
In everyday life
Look for XOR gate outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “XOR gate” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study XOR gate in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what XOR gate means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain XOR gate out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is XOR gate in simple terms?

The XOR gate (sometimes EOR, or EXOR and pronounced as exclusive OR, ksor or sometimes EX-OR) is a digital logic gate that gives a true (1 or HIGH) output when the number of true inputs is odd. An XOR gate implements an exclusive or ( ↮ {\displaystyle \nleftrightarrow } ) from mathematical logic; t…

Why does XOR gate matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study XOR gate?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on XOR gate.

Tags

  • Boolean algebra
  • Digital electronics
  • Logic gates

Keep exploring