Logical XOR
Logical XOR is a binary operation that produces true when exactly one operand is true and false when both operands have the same truth value.
Math and Architectures of Deep Learning
A Boolean operation that outputs true when exactly one of its two binary inputs is true.
- How it is used
- Uses XOR to express exclusive conditions and motivate multilayer perceptrons beyond single-perceptron linear boundaries.
- How deep it goes
- Explains truth assignments, geometric nonseparability, and an MLP decomposition into complemented conjunctions, stopping short of learned parameter values.
- Examples
- Uses a rock-music friendship rule, four binary input points, a truth table, and a two-layer perceptron construction.
- What you can do after
- Build it from scratch by expressing XOR as two conjunction terms and combining their perceptron outputs in an MLP.
Read how Math and Architectures of Deep Learning explains logical XOR →
The Well-Grounded Rubyist, Fourth Edition
Bitwise XOR is a binary operation that produces 1 where exactly one corresponding input bit is 1 and produces 0 where both corresponding input bits are equal.
- How it is used
- Applies bitwise XOR to string bytes and demonstrates reversible obfuscation with a repeating key.
- How deep it goes
- Explains bit-level behavior, a numeric calculation, reversibility, and Ruby implementation with cycling keys.
- Examples
- Uses 97 ^ 35, a repeating-key string obfuscation example, and a reversible Ruby String#^ method.
- What you can do after
- Apply via Ruby to XOR string bytes with a repeating key and recover the original by repeating the operation.
Read how The Well-Grounded Rubyist, Fourth Edition explains logical XOR →
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
The exclusive-or operation that returns true for exactly one true operand and false when both operands have the same truth value.
- How it is used
- Uses XOR to combine original bytes with dummy data and reconstruct the original through one-time pad encryption.
- How deep it goes
- Defines Boolean and bitwise behavior, demonstrates reversibility, and applies it in Swift encryption functions.
- Examples
- Demonstrates random OTP keys, encryptOTP(), decryptOTP(), and encrypting “¡Vamos Swift!” as byte sequences.
- What you can do after
- Apply XOR through Swift’s ^ operator to combine and reverse byte sequences in a one-time pad implementation.
Also covered in
- Quantum Programming in Depth
- Hacking Cryptography
- Real-World Cryptography
- Systems Programming with ZigIn early access (MEAP)
- Classic Game Programming on the NES: Make your own retro video game
- Grokking Machine Learning, Second EditionIn early access (MEAP)
- Grokking Machine Learning
What to know first
- inputAn input is information, a value, or an action supplied to a system, program, or computation for processing or to influence its behavior.
- step functionA step function is a piecewise-constant function that changes abruptly between discrete output values when its input crosses one or more specified thresholds.
- perceptronA perceptron is a single-layer computational model and linear classifier that combines weighted inputs with a bias and applies a threshold or activation rule.
Related concepts
- boolean operationkind of · A Boolean operation combines or transforms truth-valued inputs according to a logical rule to produce a logical result.
- CNOT gateimplemented by · A CNOT gate is a two-qubit controlled-NOT gate that flips a target qubit when its control qubit is one.
- HMACused by · HMAC is a keyed message authentication code constructed from a cryptographic hash function and a secret key to authenticate data and verify its integrity.
- conditional logicequivalent to · Conditional logic is a programming technique that evaluates conditions to select among execution paths, actions, or result values.
Questions about logical XOR
What is logical XOR?
Logical XOR is a binary operation that produces true when exactly one operand is true and false when both operands have the same truth value.
Which Manning books explain logical XOR?
Math and Architectures of Deep Learning, The Well-Grounded Rubyist, Fourth Edition and Classic Computer Science Problems in Swift: Essential techniques for practicing programmers.
What should I know before learning logical XOR?
Manning books that teach logical XOR usually introduce input, step function and perceptron first.
What is logical XOR a kind of?
Logical XOR is a kind of boolean operation. A Boolean operation combines or transforms truth-valued inputs according to a logical rule to produce a logical result.
What is logical XOR also called?
Logical XOR is also called exclusive OR or XOR operation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


