A binary operation is a function f (x, y) that is applied to two members of the same set S to produce a result that is also an element of the set S. Addition of integers, multiplication of whole numbers, and other binary operations are examples. A binary operation is a rule that is applied to two items of a set, with the resultant element belonging to the same set as the original.
If S is a non-empty set and * is a binary operation on S, it should satisfy the condition that says, if a ∈ S and b S, then a * b S, a, b S. I according to the definition of binary operations.
Figure 1
Binary operation Types
Binary operators are categorized as mathematical, logical, or relational. operations.
1. Addition (+)
2. Subtraction (-)
3. Multiplication (*)
4. Division (/)
These are the four basic mathematical operations.
Binary operation properties
The following are the properties of binary operations:
Commutative property: If a×b = b × a, for any (a, b) A, a binary operation * on that set is commutative (non-empty set). For a = 8 and b = 9, the operative binary operation is addition, hence a + b = 17 = b + a.
Associative property: If we can write (a* b) *c = a*(b * c) given a non-empty set A, we have the associative property of binary operations. Assume that N is a collection of natural integers, and that multiplication is a binary operation.a = 4, b = 5 ,c = 6. We can write (a* b) *c = 120 = a *(b *c).
Distributive property: Let A be a non-empty set with two binary operations * and o. If a*(b o c) = (a * b) o (a * c) or (b o c)*a = (b * a) o (c * a). The binary operations are distributive. Consider the symbols * and o to represent multiplication and subtraction, respectively. a = 2, b=5,c=4.
Then a*(b o c) = 2 (5 4) = 2 a*(b o c) = 2 a*(b o c) = 2 a*(b o c) =
a*(b o c) = a × (b – c) = 2 × (5 – 4) = 2.And (a * b) o (a * c) = (a × b) – (a × c) = (2 × 5) – (2 × 4) = 10 – 6 = 2.
Identity element: If A is a non-empty set and * is a binary operation on A, then If a * e = a = e * a, an element e is the identity element of an A. If the binary operation is addition (+), e equals 0, and if the binary operation is multiplication(*), e equals 1.
Inverse property: If a binary operation * on a set A that satisfies a * b = b * a = e is invertible for all a, b A. a-1 is invertible if a-1 = b for a * b = b * a = e. When * is multiplication, 1 is invertible.
How to do xor operation
The logical operation XOR, or eXclusive OR, compares the input values (bits) and generates the output value (bit). The exclusive OR logic is straightforward. The output is 0 if the input values are the same (or false). The outcome is 1 if the input values are different (or true).
To find XOR, we must first find both a and b’s binary representations. Let’s have a look at an example. Assume that a = 7 and b = 10. As a result, binary representations of a = 111 (as explained above) and b = 1010 are used.
Figure 1: logic symbol of XOR gate
Calculate the XOR of 2 numbers
1. First, we’ll convert both of the numbers to binary:
0101 0000 is the 8-bit binary equivalent of 80.
0110 0100 is the 8-bit binary representation of 100.
2. From the first to the last, we’ll use the rule to find the XOR of each pair of corresponding bits:
The output bit is 0 if both bits are the same, i.e. 1 (or 0).
The output is 1 if both bits are different.
3. The output bit will be 0 if the first bit pair is 0⊕0, We may determine the output bit for each pair in the same way.
Conclusion
In this article we learn that A binary operation can be thought of as a function with two elements from the same set S as input and an element from S as output. A pair (a,b) of elements in S can be represented as two elements a and b of S. and The binary number system is a variant of the decimal (10-base) number system that we are all familiar with. Binary numbers are significant because they simplify the design of computers and related technologies when compared to the decimal system.