📚 College Credit Guide ✓ UPI Study 🕐 8 min read

What Are Functions in Discrete Mathematics?

This article explains what a function is, how domain, codomain, and range work, how to read notation, and how to spot relations that are not functions.

US
UPI Study Team Member
📅 July 06, 2026
📖 8 min read
US
About the Author
The UPI Study team works directly with students on credit transfer, degree planning, and course selection. We've helped thousands of students figure out what counts toward their degree and how to finish faster without paying more than they have to. This post is written the way we'd explain it to you directly.

A function in discrete mathematics is a rule that gives each input exactly one output. That one-output rule matters more than fancy symbols, because a relation stops being a function the moment one input points to two different results. In a discrete mathematics course, you see functions in tables, ordered pairs, arrow diagrams, and notation like f(x) or f: A -> B. The shape can change, but the rule stays the same. A student studying college credit work for computer science, data analytics, or engineering will run into this idea fast, because functions sit inside logic, sets, algorithms, and program design. The tricky part is that students often mix up domain, codomain, and range. They also treat any pairing rule like a function, which gets them in trouble on quizzes. A line of notation can look harmless and still hide a clear mistake. That is why the definition matters so much in discrete mathematics: you need to know what the inputs are, what outputs the rule claims, and what outputs actually show up. This article keeps the focus tight. You will see how to read function notation, how to tell a function from a non-function, and how to use the terms the same way your professor does on homework and exams. If you can sort those pieces out, the rest of the topic starts to feel plain instead of slippery.

Mathematical study scene with open book, graph paper, and pen for learning and homework — UPI Study

What Is a Function in Discrete Mathematics?

A function in discrete mathematics is a rule that pairs each input with exactly 1 output, and that one-to-one-output rule decides everything. If the input 3 points to 7, it cannot also point to 9. That is the whole test.

Picture a rule like f(x) = x + 2 on the integers. Input 4 gives 6, input 10 gives 12, and every integer you try gets one clear result. That works because the rule never leaves an input hanging and never gives the same input 2 different answers. A lot of students miss that and call any table a function, which is sloppy.

In discrete mathematics, the set of inputs usually comes from a small, countable collection: numbers, strings, vertices, or ordered pairs. That makes the rule easy to check. A mapping from {1, 2, 3} to {a, b, c} counts as a function only if 1, 2, and 3 each land on exactly one target. If 2 points to both b and c, the rule fails right there.

The catch: A relation can look neat on paper and still fail the function test in 5 seconds. The rule, not the shape, decides it.

A solid way to think about this in a discrete mathematics course is to ask, “Can I trace every input to one and only one output?” That habit helps on homework, exams, and proofs. It also shows why function definitions and terminology matter so much in the first 3 weeks of the course. For a student working toward computer science college credit, this is not a side topic. It shows up in recursive rules, program input-output logic, and set-based models.

One ugly truth: students often trust the word “mapping” too fast. The word sounds formal, but the one-output rule still rules the room.

How Do Domain, Codomain, and Range Differ?

The domain is the set of allowed inputs, the codomain is the declared target set, and the range is the outputs that actually show up. Those 3 words look close on paper, but they do 3 different jobs in a function statement like f: A -> B.

Say a function has domain {1, 2, 3}, codomain {a, b, c, d}, and outputs {a, c}. Then 1, 2, and 3 count as inputs you may use, {a, b, c, d} names the full target set, and {a, c} gives the range you really get. The codomain can include values the function never hits. The range cannot.

Students mix these up because textbooks and instructors often compress the notation. A professor may write f: Z -> Z and then ask for the range of f(x) = x^2. Here, the domain and codomain both use integers, but the range includes only nonnegative integers like 0, 1, 4, and 9. That gap matters.

Worth knowing: A codomain can be bigger than the range by a lot. In f: {1,2,3} -> {0,1,2,3,4}, the range might only be {1,3}.

In a discrete mathematics course, this detail shows up in proofs and in grading. If the problem says codomain and you answer range, you lose the point even if your numbers look right. That feels picky, and honestly, it is picky. Still, math classes reward exact words more than fuzzy guesses.

A good habit: label each set before you start. Write D for domain, C for codomain, and R for range. Then check whether every output in R belongs to C. If the problem uses ordered pairs, the domain comes from first entries, the range from second entries, and the codomain stays whatever the problem statement says it is.

Discrete Mathematics UPI Study Course

Learn Discrete Mathematics Online for College Credit

This is one topic inside the full Discrete Mathematics course on UPI Study — a self-paced, online class that earns real college credit. Credits are ACE and NCCRS evaluated and transfer to partner colleges across the US and Canada. Courses start at $250 with no deadlines and lifetime access.

See Discrete Mathematics Course →

How Do You Read Function Notation in Discrete Mathematics?

Function notation looks small, but it carries the whole rule. In a discrete mathematics course, f(x) tells you the output tied to input x, while f: A -> B tells you the function starts in set A and lands in set B. Ordered pairs like (2, 5) and (3, 7) show the same idea in a different costume, and students who ignore the arrow or the parentheses usually miss the point on the first quiz. That is especially annoying because the notation looks easy right up until the exam asks for the domain, codomain, and range in one shot.

Reality check: A symbol can hide 3 facts at once: the input set, the target set, and the output rule. Miss one, and the answer goes sideways.

The best part of this notation is also the part students trip over: it compresses a lot of meaning into one line. A sloppy reader sees symbols. A careful reader sees a rule, a set of allowed inputs, and the exact outputs. That difference matters in any discrete mathematics class, and it matters even more when the professor asks you to prove that a relation with 6 pairs is or is not a function.

Which Relations Are Not Functions?

A relation fails to be a function the moment 1 input points to 2 different outputs, or when the rule leaves a domain element with no output. That sounds simple, and it is simple, but students still miss it on 20-point quizzes because they check the wrong thing.

Bottom line: You do not need fancy algebra to spot a bad relation. You need 2 checks: repeated inputs and missing outputs.

The graph check feels quick because it is quick. Draw a vertical line through the picture, and if it hits the graph in more than 1 place, the relation fails. The ordered-pair check works the same way. Look at first coordinates, then see whether any one of them repeats with different second coordinates.

I like this part of discrete mathematics because it rewards clean thinking, not memorized tricks. It also punishes lazy reading, which sounds harsh but saves time later. In a programming class or a logic unit, that same one-output rule keeps showing up in different clothes.

How Do Functions and Mappings Compare?

In discrete mathematics, people often use mapping and function as near-synonyms, but the word mapping usually puts more stress on where things go. The formal rule still stays the same: each input gets exactly 1 output, no more and no less.

That matters because instructors may switch words inside the same 50-minute lecture. One slide may say “function,” the next may say “mapping,” and a homework problem may say “correspondence” while still asking about the same rule. That can mess with beginners, especially in week 2 of a discrete mathematics course when notation already feels dense. The safe move is not to chase the label. Check the assignment rule first.

A mapping from a set of 6 students to a set of 3 project groups still counts as a function if each student gets exactly 1 group. If one student gets 2 groups, the mapping breaks. If one group gets no students, that does not break the function, because the one-output rule cares about inputs, not whether every target gets used.

What this means: A mapping can be formal or casual language, but the function test never changes. One input, 1 output, every time.

That last point catches a lot of students off guard, and I think textbooks should say it more bluntly. The target set can sit there unused, and the function still works. What cannot happen is one input splitting into 2 different outputs. That would wreck the whole definition, no matter whether the instructor writes function, map, or correspondence on the page.

Frequently Asked Questions about Discrete Mathematics

Final Thoughts on Discrete Mathematics

Functions in discrete mathematics look small, but they shape a lot of later work in proofs, logic, algorithms, and program design. The core idea never changes: each input gets exactly one output. Once that rule clicks, the rest starts to feel less random. Domain, codomain, and range give you the labels you need to talk about a function with precision. Domain names the allowed inputs. Codomain names the target set. Range names the outputs you actually get. Those 3 terms sound close, yet they carry different jobs, and your grade can change based on which one you name. Function notation can look dry, but it gives you a fast way to read homework and test questions. f(x), f: A -> B, ordered pairs, graphs, and tables all point to the same idea. A relation only becomes a function when every input lands on 1 output, with no exceptions. That rule is easy to state and easy to check once you practice it a few times. So take one table, one graph, or one set of ordered pairs today and test it against the definition. If you can spot the inputs, outputs, and failures without guessing, you have the topic under control.

How UPI Study credits actually work

Ready to Earn College Credit?

ACE & NCCRS approved · Self-paced · Transfer to colleges · $250/course or $99/month

© UPI Study. This article and its educational content are solely owned by UPI Study and licensed under CC BY-NC-ND 4.0. It is not free to reuse or modify. Any citation must credit UPI Study with a direct link to this page.