ArticleslgStudy

science

Ternary operation

Ternary operation is a science 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 Ternary operation rather than just read about it. In short: In mathematics, a ternary operation is an n-ary operation with n = 3. A ternary operation on a set A takes any given three elements of A and combines them to form a single element of A.

Ternary operation — main illustration
Ternary operation — illustration

Key takeaways

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

Reference excerpt

In mathematics, a ternary operation is an n-ary operation with n = 3. A ternary operation on a set A takes any given three elements of A and combines them to form a single element of A. In computer science, a ternary operator is an operator that takes three arguments as input and returns one output.

Examples

The function T ( a , b , c ) = a b + c {\displaystyle T(a,b,c)=ab+c} is an example of a ternary operation on the integers (or on any structure where + {\displaystyle +} and × {\displaystyle \times } are both defined). Properties of this ternary operation have been used to define planar ternary rings in the foundations of projective geometry. In the Euclidean plane with points a, b, c referred to an origin, the ternary operation [ a , b , c ] = a − b + c {\displaystyle [a,b,c]=a-b+c} has been used to define free vectors. Since (abc) = d implies b – a = c – d, the directed line segments b – a and c – d are equipollent and are associated with the same free vector. Any three points in the plane a, b, c thus determine a parallelogram with d at the fourth vertex. In projective geometry, the process of finding a projective harmonic conjugate is a ternary operation on three points. In the diagram, points A, B and P determine point V, the harmonic conjugate of P with respect to A and B. Point R and the line through P can be selected arbitrarily, determining C and D. Drawing AC and BD produces the intersection Q, and RQ then yields V. Suppose A and B are given sets and B ( A , B ) {\displaystyle {\mathcal {B}}(A,B)} is the collection of binary relations between A and B. Composition of relations is always defined when A = B, but otherwise a ternary composition can be defined by [ p , q , r ] = p q T r {\displaystyle [p,q,r]=pq^{T}r} where q T {\displaystyle q^{T}} is the converse relation of q. Properties of this ternary relation have been used to set the axioms for a heap. In Boolean algebra, T ( A , B , C ) = A C + ( 1 − A ) B {\displaystyle T(A,B,C)=AC+(1-A)B} defines the formula ( A ∨ B ) ∧ ( ¬ A ∨ C ) {\displaystyle (A\lor B)\land (\lnot A\lor C)} .

Computer science In computer science, an operator is a ternary operator if it takes three arguments (or operands). Many programming languages that use C-like syntax feature the ternary conditional operator, ?:, which defines a conditional expression that yields a value. This is sometimes referred to simply as the ternary operator, despite that several unrelated ternary operators exist. In the expression x = a ? b : c the variable x will be assigned the value b if a is true. Otherwise it will be assigned the value c. Some languages use a different syntax. In Python, the same expression would take the form x = b if a else c. In Excel formulae, the form is =IF(a, b, c). Many languages do not have a ternary conditional operator, though some have an alternative. For instance, although Ruby does have the ternary conditional operator, its if/elsif/else flow control structure yields a value, so it can serve the same purpose. In SQL, the CASE expression evaluates many conditionals to yield a value. These examples are not strictly ternary because they may have more than three components. Ternary operators other than the ternary conditional operator exist. In Python the expression a[b:c] will slice a portion of an array. The result is a new array containing all the elements of a from b to c-1. In OCaml the expression a.(b) <- c updates element b of array a to value c. In some assembly languages the MAD operation is in ternary form. The statement MAD a, b, c multiplies b and c, adds the result to a, and stores the final result in a, all in a single CPU cycle. In some assembly languages the order of the operands may differ. In some, the operation isn't ternary because it requires a fourth operand to indicate the location where the result will be stored. The SQL expression BETWEEN is ternary, as in age BETWEEN 90 AND 100. The Icon expression to becomes ternary when used with by, as in 1 to 10 by 2, which generates the odd integers from 1 through 9.

See also Unary operation Unary function Binary operation Iterated binary operation Binary function Median algebra or Majority function Ternary conditional operator for a list of ternary operators in computer programming languages Ternary Exclusive or Ternary equivalence relation

References

External links Media related to Ternary operations at Wikimedia Commons

Worked examples

Example 1 — a first encounter with Ternary operation

Start with the simplest possible case. Write down what Ternary operation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, 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 Ternary operation 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 Ternary operation 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 Ternary operation

In research
Ternary operation appears in science 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 Ternary operation 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
Ternary operation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Ternary operations, so understanding it makes those chapters shorter.
In everyday life
Look for Ternary operation 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 “Ternary operation” →

Affiliate

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

How to study Ternary operation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Ternary operation 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 Ternary operation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Ternary operation in simple terms?

In mathematics, a ternary operation is an n-ary operation with n = 3. A ternary operation on a set A takes any given three elements of A and combines them to form a single element of A.

Why does Ternary operation matter?

Because it connects several science 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 Ternary operation?

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 Ternary operation.

Tags

  • Ternary operations

Keep exploring