Loading [MathJax]/jax/output/HTML-CSS/jax.js
Skip to main content
LibreTexts - Ukrayinska

0.4: Функції

Template:MathJaxLevin

Функція - це правило, яке призначає кожному входу рівно один вихід. Вихід ми називаємо зображенням входу. Множина всіх входів для функції називається доменом. Безліч всіх допустимих виходів називається кодоменом. Ми б написали,f:XY щоб описати функцію зf, доменом іменіX і codomainY. Це не говорить нам,f яка функція хоча. Щоб визначити функцію, ми повинні описати правило. Це часто робиться шляхом надання формули для обчислення вихідних даних для будь-якого входу (хоча це, звичайно, не єдиний спосіб описати правило).

Наприклад, розглянемо функцію,f:\N\N визначенуf(x)=x2+3. Here, домен і codomain є однаковим набором (натуральними числами). Правило таке: візьміть свій вхід, помножте його на себе і додайте 3. Це працює, тому що ми можемо застосувати це правило до кожного натурального числа (кожного елемента домену), і результат завжди є натуральним числом (елементом codomain). Зверніть увагу, що не кожне натуральне число насправді є виходом (немає можливості отримати 0, 1, 2, 5 і т.д.). Набір натуральних чисел, які насправді є вихідними, називається діапазоном функції (в даному випадку діапазон - це{3,4,7,12,19,28,}, всі натуральні числа, які на 3 більше, ніж ідеальний квадрат).

Ключова річ, яка робить правило насправді функцією, полягає в тому, що для кожного входу є рівно один вихід. Тобто важливо, щоб правило було хорошим правилом. Який вихід ми присвоюємо входу 7? Відповідь може бути лише одна для будь-якої конкретної функції.

Опис правила може сильно відрізнятися. Ми могли б просто дати список зображень кожного входу. Ви також можете описати функцію таблицею або графіком або словами.

Приклад0.4.1

Нижче наведено всі приклади функцій:

  1. f:\Z\Zвизначеніf(n)=3n. Доменом і codomain є множиною цілих чисел. Однак діапазон - це лише набір цілих чисел, кратних 3.
  2. g:{1,2,3}{a,b,c}визначеноg(1)=c,g(2)=a іg(3)=a. Домен - це набір{1,2,3}, codomain є множиною,{a,b,c} а діапазон - набір{a,c}. Примітка, щоg(2) іg(3) є одним і тим самим елементом codomain. Це нормально, оскільки кожен елемент у домені все ще має лише один вихід.
  3. h:{1,2,3}{1,2,3}визначається наступним чином:

    arrow-function-example.svg

    Це означає, що функціяf посилає 1 до 2, 2 до 1 і 3 до 3: просто дотримуйтесь стрілок.

Діаграма стрілок, яка використовується для визначення функції вище, може бути дуже корисною для візуалізації функцій. Ми часто працюватимемо з функціями з кінцевими доменами, тому подібна картинка часто корисніша, ніж традиційний графік функції. Графік функції у прикладі 3 вище виглядатиме так:

discrete-function-graph.svg

Було б абсолютно НЕПРАВИЛЬНО з'єднувати точки або намагатися підігнати їх до якоїсь кривої. У домені всього три елементи. Крива говорить про те, що домен містить цілий інтервал дійсних чисел. Пам'ятайте, ми більше не в обчисленні!

Оскільки ми будемо так часто використовувати функції з невеликими доменами та кодоменами, давайте візьмемо деякі позначення, з якими працювати трохи простіше, ніж у прикладах 2 та 3 вище. Все, що нам потрібно, це якийсь чіткий спосіб позначення зображення кожного елемента в домені. Насправді написання таблиці значень працювало б ідеально:

x 0 1 2 3 4
f(x) 3 3 2 4 1

Ми спростимо це далі, записуючи це як матрицю з кожним входом безпосередньо над його виходом:

\ begin {рівняння*} f =\ почати {pmatrix} 0 & 1 & 2 & 3 & 4\ 3 & 3 & 3 & 2 & 2 & 4 & 1\ кінець {pmatrix}\ кінець {рівняння*}

Зауважте, що це просто позначення, а не така ж матриця, яку ви знайдете в класі лінійної алгебри (не має сенсу робити операції з цими матрицями, або рядки зменшують їх, наприклад).

Важливо знати, як визначити, чи є правило функцією чи ні. Малювання діаграм стрілок може допомогти.

Приклад0.4.2

Яка з наведених нижче діаграм представляє функцію? НехайX={1,2,3,4} іY={a,b,c,d}.

h-arrows.svgf-arrows.svgg-arrows.svg

Рішення

f is a function. So is g. There is no problem with an element of the codomain not being the image of any input, and there is no problem with a from the codomain being the image of both 2 and 3 from the domain. We could use our two-line notation to write these as

\ begin {рівняння*} f=\ почати {pmatrix} 1 & 2 & 3 & 4\\ d & a & c & b\ end {pmatrix}\ qquad g =\ почати {pmatrix} 1 & 2 & 3\\\ d & a & b\ end {pmatrix}. \ end {рівняння*}

Однак,h is NOT a function. In fact, it fails for two reasons. First, the element 1 from the domain has not been mapped to any element from the codomain. Second, the element 2 from the domain has been mapped to more than one element from the codomain (a and c). Note that either one of these problems is enough to make a rule not a function. In general, neither of the following mappings are functions:

not-function-a.svgnot-function-b.svg

Також може бути корисно подумати про те, як би ви написали дворядкове позначення дляh. We would have something like:

h=(1234a,c?db).

There is nothing under 1 (bad) and we needed to put more than one thing under 2 (very bad). With a rule that is actually a function, the two-line notation will always “work”.

Surjections, Injections, and Bijections

We now turn to investigating special properties functions might or might not possess.

In the examples above, you may have noticed that sometimes there are elements of the codomain which are not in the range. When this sort of the thing does not happen, (that is, when everything in the codomain is in the range) we say the function is onto or that the function maps the domain onto the codomain. This terminology should make sense: the function puts the domain (entirely) on top of the codomain. The fancy math term for an onto function is a surjection, and we say that an onto function is a surjective function.

In pictures:

non-surjective-ex.svg surjective-ex.svg

Example 0.4.3: Surjective Functions

Which functions are surjective (i.e., onto)?

  1. f:\Z\Z defined by f(n)=3n.
  2. g:{1,2,3}{a,b,c} defined by g=(123caa).
  3. h:{1,2,3}{1,2,3} defined as follows:

ex-surj-q.svg

Solution
  1. f is not surjective. There are elements in the codomain which are not in the range. For example, no n\Z gets mapped to the number 1 (the rule would say that 13 would be sent to 1, but 13 is not in the domain). In fact, the range of the function is 3\Z (the integer multiples of 3), which is not equal to \Z.
  2. g is not surjective. There is no x{1,2,3} (the domain) for which g(x)=b, so b, which is in the codomain, is not in the range. Notice that there is an element from the codomain “missing” from the bottom row of the matrix.
  3. h is surjective. Every element of the codomain is also in the range. Nothing in the codomain is missed.

To be a function, a rule cannot assign a single element of the domain to two or more different elements of the codomain. However, we have seen that the reverse is permissible: a function might assign the same element of the codomain to two or more different elements of the domain. When this does not occur (that is, when each element of the codomain is the image of at most one element of the domain) then we say the function is one-to-one. Again, this terminology makes sense: we are sending at most one element from the domain to one element from the codomain. One input to one output. The fancy math term for a one-to-one function is an injection. We call one-to-one functions injective functions.

In pictures:

injective-ex.svg non-injective-ex.svg

Example 0.4.4

Which functions are injective (i.e., one-to-one)?

  1. f:\Z\Z defined by f(n)=3n.
  2. g:{1,2,3}{a,b,c} defined by g=(123caa).
  3. h:{1,2,3}{1,2,3} defined as follows:

    ex-inj-q.svg

Solution
  1. f is injective. Each element in the codomain is assigned to at most one element from the domain. If x is a multiple of three, then only x/3 is mapped to x. If x is not a multiple of 3, then there is no input corresponding to the output x.
  2. g is not injective. Both inputs 2 and 3 are assigned the output a. Notice that there is an element from the codomain that appears more than once on the bottom row of the matrix.
  3. h is injective. Each output is only an output once.

From the examples above, it should be clear that there are functions which are surjective, injective, both, or neither. In the case when a function is both one-to-one and onto (an injection and surjection), we say the function is a bijection, or that the function is a bijective function.

Inverse Image

When discussing functions, we have notation for talking about an element of the domain (say x) and its corresponding element in the codomain (we write f(x), which is the image of x). It would also be nice to start with some element of the codomain (say y) and talk about which element or elements (if any) from the domain it is the image of. We could write “those x in the domain such that f(x)=y,” but this is a lot of writing. Here is some notation to make our lives easier.

Suppose f:XY is a function. For yY (an element of the codomain), we write f\inv(y) to represent the set of all elements in the domain X which get sent to y. That is, f\inv(y)={xX\stf(x)=y}. We say that f\inv(y) is the complete inverse image of y under f.

WARNING: f\inv(y) is not an inverse function! Inverse functions only exist for bijections, but f\inv(y) is defined for any function f. The point: f\inv(y) is a set, not an element of the domain.

Example 0.4.5

Consider the function f:{1,2,3,4,5,6}{a,b,c,d} given by

f=(123456aabccc).

Find the complete inverse image of each element in the codomain.

Solution

Remember, we are looking for sets.

f\inv(a)={1,2} f\inv(b)={3} f\inv(c)={4,5,6} f\inv(d)=.

Example 0.4.6

Consider the function g:\Z\Z defined by g(n)=n2+1. Find g\inv(1), g\inv(2), g\inv(3) and g\inv(10).

Solution

To find g\inv(1), we need to find all integers n such that n2+1=1. Clearly only 0 works, so g\inv(1)={0} (note that even though there is only one element, we still write it as a set with one element in it).

To find g\inv(2), we need to find all n such that n2+1=2. We see g\inv(2)={1,1}.

If n2+1=3, then we are looking for an n such that n2=2. There are no such integers so g\inv(3)=.

Finally, g\inv(10)={3,3} because g(3)=10 and g(3)=10.

Since f\inv(y) is a set, it makes sense to ask for \cardf\inv(y), the number of elements in the domain which map to y.

Example 0.4.7

Find a function f:{1,2,3,4,5}\N such that \cardf\inv(7)=5.

Solution

There is only one such function. We need five elements of the domain to map to the number 7\N. Since there are only five elements in the domain, all of them must map to 7. So

f=(1234577777).

Function Definitions

  • A function is a rule that assigns each element of a set, called the domain, to exactly one element of a second set, called the codomain.
  • Notation: f:XY is our way of saying that the function is called f, the domain is the set X, and the codomain is the set Y.
  • To specify the rule for a function with small domain, use two-line notation by writing a matrix with each output directly below its corresponding input, as in:

    f=(12342131).

  • f(x)=y means the element x of the domain (input) is assigned to the element y of the codomain. We say y is an output. Alternatively, we call y the image of x under f.
  • The range is a subset of the codomain. It is the set of all elements which are assigned to at least one element of the domain by the function. That is, the range is the set of all outputs.
  • A function is injective (an injection or one-to-one) if every element of the codomain is the output for at most one element from the domain.
  • A function is surjective (a surjection or onto) if every element of the codomain is the output of at least one element of the domain.
  • A bijection is a function which is both an injection and surjection. In other words, if every element of the codomain is the output of exactly one element of the domain.
  • The image of an element x in the domain is the element y in the codomain that x is mapped to. That is, the image of x under f is f(x).
  • The complete inverse image of an element y in the codomain, written f\inv(y), is the set of all elements in the domain which are assigned to y by the function.
  • Was this article helpful?