Definition

Function એટલે એક ભરોસાપાત્ર નિયમ: એક set માંથી આવતા દરેક input ને બીજા set માં બરાબર એક જ output મળે, ના કોઈ છૂટી જાય ના કોઈને 2 મળે.

9 min read · 12 cards · 3 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

The vending machine test

એક vending machine નું કામ સીધું છે: તમે B4 દબાવો, એટલે B4 વાળી જગ્યાએ મૂકેલી વસ્તુ મળે. દરેક button કંઈક આપે છે, અને એવું ક્યારેય નહીં થાય કે આજે એક વસ્તુ ને કાલે બીજી.

હવે કલ્પના કરો કે એ machine બગડી ગઈ છે: અમુક button દબાવો તો કંઈ મળે જ નહીં, અને એક button ક્યારેક chips આપે ને ક્યારેક cold drink. તો તમે એના પર ભરોસો કરવાનું બંધ કરી દો, ખરું ને?

Mathematics માં આવી ભરોસાપાત્ર machine માટે એક નામ છે: function.

Theory

Input goes in, one output comes out

દરેક function એ જ ભરોસાપાત્ર machine છે: allowed inputs ના fixed set માંથી એક input આપો, એટલે એ બરાબર એક જ output પાછું આપશે. આજે જે input આપ્યું એ જ input કાલે આપો, તો એ જ output મળશે. આખી formal definition એટલે બસ આ વચન symbols માં લખેલું.

Theory

The definition, formally

ધારો કે A અને B 2 sets છે. એક function f: A → B એ એવો નિયમ છે જે A ના દરેક element a ∈ A ને B નો બરાબર એક element assign કરે, જેને f(a) લખાય.

આ એક વાક્યમાં 2 શરતો છુપાયેલી છે:

  • each: A નો કોઈ element output વગરનો ના રહેવો જોઈએ
  • exactly one: A ના કોઈ element ને 2 output ના મળવા જોઈએ

આ બેમાંથી કોઈ પણ એક શરત તૂટે, તો એ નિયમ function કહેવાય જ નહીં.

Theory

Domain, codomain, range

f: A → B માટે:

  • Domain = A, એટલે allowed inputs નો set
  • Codomain = B, એટલે જ્યાંથી outputs આવવાના છે એવું જાહેર કરેલો set
  • Range = જે outputs ખરેખર આવે છે એ

એક example લઈએ: f: ℤ → ℤ, જ્યાં f(x) = 2x. અહીં domain અને codomain બંને બધા integers છે, પણ range તો ફક્ત even integers જ છે. Range હંમેશા codomain ની અંદર જ રહે છે: range ⊆ codomain.

Quiz

f: ℤ → ℤ, જ્યાં f(x) = x², તો એની range શું થાય?

  1. બધા integers, codomain જેવી જ
  2. Perfect squares {0, 1, 4, 9, 16, ...}
  3. બધા non-negative integers {0, 1, 2, 3, ...}
  4. બધા even integers
Show the answer

Perfect squares {0, 1, 4, 9, 16, ...}

Range એટલે machine ખરેખર જે બનાવે એ: 0, 1, 4, 9, 16 વગેરે. Codomain તો આખું ℤ જાહેર કરેલું છે, પણ એટલા માત્રથી દરેક integer output બની જતું નથી. Option A અને C એ range અને codomain વચ્ચેની 2 classic ગૂંચવણ છે.

Think first

2 નિયમ છે, બંને લોકોને લોકો કે numbers સાથે map કરે છે. દરેક માટે નક્કી કરો: function કે નહીં?

1. દરેક વ્યક્તિ → એનો Aadhaar number

2. દરેક વ્યક્તિ → એનાં parent

Show the answer

1 એ function છે: એક વ્યક્તિ, એક જ Aadhaar number.

2 એ function નથી: એક વ્યક્તિને 2 parent હોય, એટલે એક input માંથી 2 output નીકળે, અને એમ "exactly one" તૂટી જાય. અને જો કોઈ નિયમ એવો હોય કે અમુક વ્યક્તિને output જ ના મળે, તો "each" તૂટે. કોઈ નિયમ fail થવાની આ 2 જ રીત છે.

Theory

The rule polices inputs, not outputs

ફરી f(x) = x² જુઓ: f(2) = 4 અને f(−2) = 4. 2 અલગ inputs, પણ output એક જ.

આમાં કંઈ ખોટું નથી, બિલકુલ allowed છે. Definition ક્યાંય એવું નથી કહેતી કે outputs અલગ અલગ જ હોવા જોઈએ. એ ફક્ત એટલું કહે છે કે એક input ના 2 output ના થાય.

Inputs ને roll number વાળા students જેવા સમજો: દરેક student ને એક જ roll number હોય, પણ 2 students ને એકસરખા marks આવી શકે.

Quiz

તમારા classmates ના set માંથી numbers સુધીના આમાંથી કયો નિયમ function IS?

  1. દરેક student → Maths માં એણે મેળવેલા marks
  2. દરેક student → એનાં ભાઈબહેનની ઉંમર
  3. દરેક student → એને ગમતા subjects
  4. દરેક student → એક number જે એની પાસે હોય પણ ખરો ને ના પણ હોય
Show the answer

દરેક student → Maths માં એણે મેળવેલા marks

Marks દરેક student ને બરાબર એક number આપે છે. ભાઈબહેન કોઈને ના હોય કે ઘણાં હોય (બંને શરત તૂટે), ગમતા subjects ઘણા હોઈ શકે ("exactly one" તૂટે), અને "હોય પણ ખરો ને ના પણ હોય" એ "each" તોડે છે. Function માં ના કોઈ gap ચાલે, ના કોઈ double.

Watch out

The trap that costs marks

Students ઘણી વાર સાચા functions ને પણ ના પાડી દે છે, એમ કહીને કે "2 inputs એક જ output આપે છે". અરે, એ તો allowed છે! f(x) = x² એ function જ છે. ફક્ત આ 2 સાચી શરત check કરો: દરેક input cover થાય છે, અને દરેકને એક જ output મળે છે. અને range = codomain એવું check કર્યા વગર ક્યારેય ના લખો; સામાન્ય રીતે એવું હોતું નથી.

Formula

The two-question exam check

કોઈ પણ નિયમ આપીને પૂછે કે "આ function છે?", તો 2 check થી જવાબ આપો: (1) Domain ના દરેક element ને output મળે છે? (2) કોઈ element ને એક કરતાં વધારે output મળે છે? જો પહેલાનો જવાબ હા અને બીજાનો ના, તો એ function છે. પૂરા marks માટે તમારા જવાબમાં આ બંને check લખો.

Theory

Where you will meet this again

C કે Python માં તમે જે પણ function લખશો એ આ જ idea છે: arguments અંદર જાય, એક return value બહાર આવે. Database નું primary key પણ આ જ કારણથી દરેક key ને બરાબર એક જ row સાથે map કરે છે. આગળના topics આજના પર જ ઊભા છે: પહેલા domain અને range વિગતવાર, પછી types of functions.

Summary

Key takeaways

  • Function f: A → B એ A ના દરેક element ને B નો બરાબર એક element આપે છે.
  • Domain = allowed inputs, codomain = જાહેર કરેલો output set, range = ખરેખરના outputs, અને range ⊆ codomain.
  • નિયમ ફક્ત 2 રીતે fail થાય: કોઈ input ને output જ ના મળે, અથવા કોઈ input ને 2 output મળે.
  • અલગ inputs એક જ output share કરે એ allowed છે: f(x) = x² એનો પુરાવો છે.
  • યાદ રાખવાની trick: એક input, એક output, કોઈ બહાનું નહીં.

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Functions

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati