此條目介紹的是数学中的函数。关于程序设计中的函数,请见「
子程序 」。
函数
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 黑箱 ,给予输入值
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
  函数 (英語:function )是數學 描述對應關係的一種特殊集合 ;粗略地說,從集合
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 [ 2] 
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 定义域 [ 3] 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 到达域 。[ 4] 
函數最初是一個變化的量如何依賴另一個量的理想化。例如,特定時間行星的位置可以視為是行星的位置對時間的函數。“函数”一词作为数学概念是由莱布尼茨 首先引入的。[ 5] 
將形狀映射到其顏色的函數 若
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 實數 ,以有序對 
  
    
      
        ( 
        x 
        , 
        
          x 
          
            2 
           
         
        ) 
       
     
    {\displaystyle (x,\,x^{2})} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        
          x 
          
            2 
           
         
       
     
    {\displaystyle x^{2}} 
   
 
一般會以英文字母
  
    
      
        f 
        , 
        g 
        , 
        h 
       
     
    {\displaystyle f,\,g,\,h} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
 f of x 」。函数的概念不限於數之间的對應关系,例定义函数
  
    
      
        Capital 
       
     
    {\displaystyle \operatorname {Capital} } 
   
 英国 就會输出唯一值伦敦 :
  
    
      
        Capital 
         
        ( 
        
          U 
          . 
          K 
          . 
         
        ) 
        = 
        
          L 
          o 
          n 
          d 
          o 
          n 
         
       
     
    {\displaystyle \operatorname {Capital} (\mathrm {U.K.} )=\mathrm {London} } 
   
 
直觀上的「多變數函數」其實也可以概括到一般函數的定義裡。例如算式
  
    
      
        x 
        × 
        y 
       
     
    {\displaystyle x\times y} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        y 
       
     
    {\displaystyle y} 
   
 有序对 
  
    
      
        ( 
        x 
        , 
        y 
        ) 
       
     
    {\displaystyle (x,y)} 
   
 
  
    
      
        ( 
        ( 
        x 
        , 
        y 
        ) 
        , 
        x 
        × 
        y 
        ) 
       
     
    {\displaystyle ((x,\,y),\,x\times y)} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        f 
        [ 
        ( 
        x 
        , 
        y 
        ) 
        ] 
        = 
        x 
        × 
        y 
       
     
    {\displaystyle f[(x,\,y)]=x\times y} 
   
 
  
    
      
        f 
        ( 
        x 
        , 
        y 
        ) 
        = 
        x 
        × 
        y 
       
     
    {\displaystyle f(x,\,y)=x\times y} 
   
 
數學中,对应 、映射 、变换 通常都是函数的別稱,但也可能有別的意思,如在拓扑學 的映射有时代表的是连续函数 。
在類型論 的λ演算 中,「對應關係」可以是作為一個原始概念(也就是無定義名詞),而不像上述的定義把函數視為集合 的衍伸物。
函數的值域 或像 是定义域 中所有元素的像 之集合。[ 6] [ 7] [ 8] [ 9] 
函数(function)这个数学名词是莱布尼兹 在1694年开始使用的,用來描述跟曲线 相关的一個量,如曲线的斜率 或者曲线上的某一点。莱布尼兹所指的函数现在被称作可导函数 ,数学家之外的普通人一般接触到的函数即属此类。对于可导函数可以讨论它的极限 和导数 ,此两者描述了函数输出值的变化同输入值变化的关系,是微积分学 的基础。中文的「函数 」一词由清朝 数学家李善兰 译出。其《代数学》书中解释:「凡此變數中函(包含)彼變數者,則此為彼之函數」。
1718年,約翰·伯努利 把函数定义为「一个变量的函数是指由这个变量和常量以任何一种方式组成的一种量。」 
1748年,伯努利的学生欧拉 在《无穷分析引论》一书中说:「一个变量 的函数是由该变量和一些数或常量 以任何一种方式构成的解析表达式 」,例如
  
    
      
        f 
        ( 
        x 
        ) 
        = 
        sin 
         
        ( 
        x 
        ) 
        + 
        
          x 
          
            2 
           
         
       
     
    {\displaystyle f(x)=\sin(x)+x^{2}} 
   
  
1775年,欧拉在《微分学原理》一书中又提出了函数的一个定义:「如果某些量以如下方式依赖于另一些量,即当后者变化时,前者本身也发生变化,则称前一些量是后一些量的函数。」 
19世纪的数学家开始对数学的各个分支進行形式化。维尔斯特拉斯 倡議将微积分学建立在算术 ,而不是几何 的基础上,這種主張較趋向于欧拉的定义。 
函数的定义得以擴展之後,数学家便能对一些「奇怪」的数学对象 进行研究,例如處處不可导的连续函数 。这些函数曾经被认为只具有理论价值,迟至20世纪初时它们仍被视作「怪物」。稍后,人们发现这些函数在对如布朗运动 之类的物理现象进行建模时有重要的作用。 
到19世纪末,数学家开始尝试利用集合论 来進行数学的形式化。他们试图将每一個数学对象都定义为集合 。狄利克雷 给出了现代正式的函数定义(参见下文#正式定義 )。在他的定義下,函数被视作数学关系 的特例。然而对于实际应用的情况,现代定义和欧拉定义的区别可以忽略不计。 函数
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        f 
        ( 
        x 
        ) 
        = 
        
          x 
          
            3 
           
         
        − 
        9 
        x 
       
     
    {\displaystyle f(x)=x^{3}-9x} 
   
  
定義  —  二元關係  
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        ( 
        ∀ 
        x 
        ) 
        ( 
        ∀ 
        y 
        ) 
        ( 
        ∀ 
        
          y 
          
            ′ 
           
         
        ) 
        { 
        [ 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
        ∧ 
        ( 
        ⟨ 
        x 
        , 
        
          y 
          
            ′ 
           
         
        ⟩ 
        ∈ 
        f 
        ) 
        ] 
        ⇒ 
        ( 
        y 
        = 
        
          y 
          
            ′ 
           
         
        ) 
        } 
       
     
    {\displaystyle (\forall x)(\forall y)(\forall y^{\prime })\{\,[\,(\langle x,\,y\rangle \in f)\wedge (\langle x,\,y^{\prime }\rangle \in f)\,]\Rightarrow (y=y^{\prime })\,\}} 
   
 則稱為 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
 
(為了避免
  
    
      
        ( 
        x 
        , 
        y 
        ) 
       
     
    {\displaystyle (x,\,y)} 
   
 逻辑 敘述的括弧混淆,也會用
  
    
      
        ⟨ 
        x 
        , 
        y 
        ⟩ 
       
     
    {\displaystyle \langle x,\,y\rangle } 
   
 有序对 )
也就是直觀上,有序对 
  
    
      
        ( 
        x 
        , 
        y 
        ) 
       
     
    {\displaystyle (x,\,y)} 
   
 輸入值 , 輸出值 );而
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 輸入值 , 輸出值 )來詳盡定義的對應規則,且每個輸入值只能對應一個輸出值 。
習慣上把
  
    
      
        ( 
        x 
        , 
        y 
        ) 
        ∈ 
        f 
       
     
    {\displaystyle (x,\,y)\in f} 
   
 
  
    
      
        y 
        = 
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle y=f(x)} 
   
 
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
 一阶逻辑 公理化集合论 下額外新增的雙元函數符號 (因為
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
公理  —  
  
    
      
        [ 
        ¬ 
        ( 
        
          
            B 
           
         
        ∧ 
        
          
            C 
           
         
        ) 
        ∧ 
        ( 
        f 
        ( 
        x 
        ) 
        = 
        ∅ 
        ) 
        ] 
        ∨ 
        [ 
        ( 
        
          
            B 
           
         
        ∧ 
        
          
            C 
           
         
        ) 
        ∧ 
        ( 
        ⟨ 
        x 
        , 
        f 
        ( 
        x 
        ) 
        ⟩ 
        ∈ 
        f 
        ) 
        ] 
       
     
    {\displaystyle [\,\neg ({\mathcal {B}}\wedge {\mathcal {C}})\wedge (f(x)=\varnothing )\,]\vee [\,({\mathcal {B}}\wedge {\mathcal {C}})\wedge (\langle x,\,f(x)\rangle \in f)\,]} 
   
 其中: 
  
    
      
        
          
            B 
           
         
        := 
        ( 
        ∀ 
        x 
        ) 
        ( 
        ∀ 
        y 
        ) 
        ( 
        ∀ 
        
          y 
          
            ′ 
           
         
        ) 
        { 
        [ 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
        ∧ 
        ( 
        ⟨ 
        x 
        , 
        
          y 
          
            ′ 
           
         
        ⟩ 
        ∈ 
        f 
        ) 
        ] 
        ⇒ 
        ( 
        y 
        = 
        
          y 
          
            ′ 
           
         
        ) 
        } 
       
     
    {\displaystyle {\mathcal {B}}:=(\forall x)(\forall y)(\forall y^{\prime })\{\,[\,(\langle x,\,y\rangle \in f)\wedge (\langle x,\,y^{\prime }\rangle \in f)\,]\Rightarrow (y=y^{\prime })\,\}} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        
          
            C 
           
         
        := 
        ( 
        ∃ 
        y 
        ) 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
       
     
    {\displaystyle {\mathcal {C}}:=(\exists y)(\langle x,\,y\rangle \in f)} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
  
新增公理的合理性 
 
假設有
  
    
      
        
          
            B 
           
         
        ∧ 
        
          
            C 
           
         
       
     
    {\displaystyle {\mathcal {B}}\wedge {\mathcal {C}}} 
   
 公式 
  
    
      
        
          
            B 
           
         
       
     
    {\displaystyle {\mathcal {B}}} 
   
 量词公理A4 有:
  
    
      
        ( 
        ∀ 
        y 
        ) 
        ( 
        ∀ 
        
          y 
          
            ′ 
           
         
        ) 
        { 
        [ 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
        ∧ 
        ( 
        ⟨ 
        x 
        , 
        
          y 
          
            ′ 
           
         
        ⟩ 
        ∈ 
        f 
        ) 
        ] 
        ⇒ 
        ( 
        y 
        = 
        
          y 
          
            ′ 
           
         
        ) 
        } 
       
     
    {\displaystyle (\forall y)(\forall y^{\prime })\{\,[\,(\langle x,\,y\rangle \in f)\wedge (\langle x,\,y^{\prime }\rangle \in f)\,]\Rightarrow (y=y^{\prime })\,\}} 
   
 這樣綜合上式和
  
    
      
        
          
            C 
           
         
       
     
    {\displaystyle {\mathcal {C}}} 
   
 
  
    
      
        ( 
        ∃ 
        ! 
        y 
        ) 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
       
     
    {\displaystyle (\exists !y)(\langle x,\,y\rangle \in f)} 
   
 換句話說:
  
    
      
        
          
            B 
           
         
        ∧ 
        
          
            C 
           
         
        ⊢ 
        ( 
        ∃ 
        ! 
        y 
        ) 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
       
     
    {\displaystyle {\mathcal {B}}\wedge {\mathcal {C}}\vdash (\exists !y)(\langle x,\,y\rangle \in f)} 
   
 這樣根據特定條件下的存在性 就有:
  
    
      
        ⊢ 
        ( 
        ∃ 
        ! 
        y 
        ) 
        { 
        [ 
        ¬ 
        ( 
        
          
            B 
           
         
        ∧ 
        
          
            C 
           
         
        ) 
        ∧ 
        ( 
        y 
        = 
        ∅ 
        ) 
        ] 
        ∨ 
        [ 
        ( 
        
          
            B 
           
         
        ∧ 
        
          
            C 
           
         
        ) 
        ∧ 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
        ] 
        } 
       
     
    {\displaystyle \vdash (\exists !y)\{\,[\,\neg ({\mathcal {B}}\wedge {\mathcal {C}})\wedge (y=\varnothing )\,]\vee [\,({\mathcal {B}}\wedge {\mathcal {C}})\wedge (\langle x,\,y\rangle \in f)\,]\,\}} 
   
 這樣根據函數符號與唯一性 的內容,就可以於策梅洛-弗兰克尔集合论 增加上述的公理與雙元函數符號
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
 
  
直觀上,這個公理表示「若
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        ⟨ 
        x 
        , 
        f 
        ( 
        x 
        ) 
        ⟩ 
        ∈ 
        f 
       
     
    {\displaystyle \langle x,\,f(x)\rangle \in f} 
   
 
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
 空集 」。
這樣根據函數符號與唯一性的定理(E) ,就會有本節一開始所說的直觀性質:
  
    
      
        
          
            B 
           
         
        ∧ 
        
          
            C 
           
         
        ⊢ 
        ( 
        ∀ 
        y 
        ) 
        { 
        [ 
        y 
        = 
        f 
        ( 
        x 
        ) 
        ] 
        ⇔ 
        [ 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ] 
        } 
       
     
    {\displaystyle {\mathcal {B}}\land {\mathcal {C}}\vdash (\forall y)\{\,[\,y=f(x)\,]\Leftrightarrow [\,\langle x,\,y\rangle \in f\,]\,\}} 
   
 也就是「若
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        y 
       
     
    {\displaystyle y} 
   
 
  
    
      
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
       
     
    {\displaystyle \langle x,\,y\rangle \in f} 
   
 
  
    
      
        y 
        = 
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle y=f(x)} 
   
 
對於「n變數」的函數,也就是以
  
    
      
        ( 
        ( 
        
          x 
          
            1 
           
         
        , 
        ⋯ 
        , 
        
          x 
          
            n 
           
         
        ) 
        , 
        y 
        ) 
       
     
    {\displaystyle ((x_{1},\,\cdots ,\,x_{n}),\,y)} 
   
 為元素的函數
  
    
      
        
          
            f 
           
         
       
     
    {\displaystyle {\mathcal {f}}} 
   
 項 
  
    
      
        f 
        [ 
        ( 
        
          x 
          
            1 
           
         
        , 
        ⋯ 
        , 
        
          x 
          
            n 
           
         
        ) 
        ] 
       
     
    {\displaystyle f[(x_{1},\cdots ,\,x_{n})]} 
   
 進一步簡寫為
  
    
      
        f 
        ( 
        
          x 
          
            1 
           
         
        , 
        ⋯ 
        , 
        
          x 
          
            n 
           
         
        ) 
       
     
    {\displaystyle f(x_{1},\cdots ,\,x_{n})} 
   
 如果能指出函數
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 公理化集合論 中,分类公理 確保對任意集合 
  
    
      
        A 
       
     
    {\displaystyle A} 
   
 
  
    
      
        
          D 
          
            A 
           
         
       
     
    {\displaystyle D_{A}} 
   
 
  
    
      
        
          I 
          
            A 
           
         
       
     
    {\displaystyle I_{A}} 
   
 函數符號 )分別滿足
  
    
      
        ( 
        ∀ 
        x 
        ) 
        { 
        ( 
        x 
        ∈ 
        
          D 
          
            A 
           
         
        ) 
        ⇔ 
        ( 
        ∃ 
        y 
        ) 
        [ 
        ( 
        x 
        , 
        y 
        ) 
        ∈ 
        A 
        ] 
        } 
       
     
    {\displaystyle (\forall x)\{(x\in D_{A})\Leftrightarrow (\exists y)[\,(x,\,y)\in A\,]\}} 
   
 
  
    
      
        ( 
        ∀ 
        y 
        ) 
        { 
        ( 
        y 
        ∈ 
        
          I 
          
            A 
           
         
        ) 
        ⇔ 
        ( 
        ∃ 
        x 
        ) 
        [ 
        ( 
        x 
        , 
        y 
        ) 
        ∈ 
        A 
        ] 
        } 
       
     
    {\displaystyle (\forall y)\{(y\in I_{A})\Leftrightarrow (\exists x)[\,(x,\,y)\in A\,]\}} 
   
 直觀上,
  
    
      
        
          D 
          
            A 
           
         
       
     
    {\displaystyle D_{A}} 
   
 
  
    
      
        A 
       
     
    {\displaystyle A} 
   
 有序对 的第一個所構成的集合;
  
    
      
        
          I 
          
            A 
           
         
       
     
    {\displaystyle I_{A}} 
   
 
  
    
      
        A 
       
     
    {\displaystyle A} 
   
 有序对 的第二個所構成的集合。這樣的話,如果
  
    
      
        A 
       
     
    {\displaystyle A} 
   
 
  
    
      
        
          D 
          
            A 
           
         
       
     
    {\displaystyle D_{A}} 
   
 定義域 ;類似地,
  
    
      
        
          I 
          
            A 
           
         
       
     
    {\displaystyle I_{A}} 
   
 值域 。
通常情況下,有以下慣用的記號
  
    
      
        f 
        : 
        X 
        → 
        Y 
        := 
        [ 
        ( 
        f 
        
           is a function 
         
        ) 
        ∧ 
        ( 
        
          D 
          
            f 
           
         
        = 
        X 
        ) 
        ∧ 
        ( 
        
          I 
          
            f 
           
         
        ⊆ 
        Y 
        ) 
        ] 
       
     
    {\displaystyle f:X\to Y:=[\,(f{\text{ is a function}})\wedge (D_{f}=X)\wedge (I_{f}\subseteq Y)\,]} 
   
 也就是直觀上,
  
    
      
        f 
        : 
        X 
        → 
        Y 
       
     
    {\displaystyle f:X\to Y} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 定義域 為
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 值域 包含於
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 對應域 。
屬於定義域
  
    
      
        
          D 
          
            f 
           
         
       
     
    {\displaystyle D_{f}} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 自變量 (independent variable),而項
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
 因變量( dependent variable),但是這跟實驗上的自变量和因变量 是稍有不同的,因為前者是現實得到的實驗值之間的關聯,但另一個是源於集合論的概念。
定義  —  
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        ( 
        ∀ 
        y 
        ) 
        ( 
        ∀ 
        x 
        ) 
        ( 
        ∀ 
        
          x 
          
            ′ 
           
         
        ) 
        { 
        [ 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
        ∧ 
        ( 
        ⟨ 
        
          x 
          
            ′ 
           
         
        , 
        y 
        ⟩ 
        ∈ 
        f 
        ) 
        ] 
        ⇒ 
        ( 
        x 
        = 
        
          x 
          
            ′ 
           
         
        ) 
        } 
       
     
    {\displaystyle (\forall y)(\forall x)(\forall x^{\prime })\{\,[\,(\langle x,\,y\rangle \in f)\wedge (\langle x^{\prime },\,y\rangle \in f)\,]\Rightarrow (x=x^{\prime })\,\}} 
   
 
則被稱為一對一的 (one-to-one)或是单射 (injective function)。
 
直觀上,若函數
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
若
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 分类公理 所取的)以下的集合:
  
    
      
        
          f 
          
            − 
            1 
           
         
        := 
        { 
        p 
        
          | 
         
        ( 
        ∃ 
        x 
        ) 
        ( 
        ∃ 
        y 
        ) 
        [ 
        p 
        = 
        ( 
        y 
        , 
        x 
        ) 
        ∧ 
        y 
        = 
        f 
        ( 
        x 
        ) 
        ] 
        } 
       
     
    {\displaystyle f^{-1}:=\{\,p\,|\,(\exists x)(\exists y)[\,p=(y,\,x)\,\wedge \,y=f(x)\,]\,\}} 
   
 也是一個函數,被稱為
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 反函數 。
  
    
      
        f 
        : 
        X 
        → 
        Y 
       
     
    {\displaystyle f:X\to Y} 
   
 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 满射 (surjective function)定義為「
  
    
      
        f 
        : 
        X 
        → 
        Y 
       
     
    {\displaystyle f:X\to Y} 
   
 值域 就是
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 
(1)一對多。
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 中的元素3与
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 中的两个元素
  
    
      
        b 
       
     
    {\displaystyle b} 
   
 和
  
    
      
        c 
       
     
    {\displaystyle c} 
   
 相关。因此这是
多值函数 ,而不是函数。
(2)一對一但非完全對應。
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 的元素1未与
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 的任一元素相关。因此这是
偏函数 ,而
不是 函数。
(3)完全對應且多对一,因此这是从
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 到
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 的函数。此函数可以表示为
  
    
      
        f 
        = 
        { 
        ( 
        1 
        , 
        d 
        ) 
        , 
        ( 
        2 
        , 
        d 
        ) 
        , 
        ( 
        3 
        , 
        c 
        ) 
        } 
       
     
    {\displaystyle f=\{\,(1,d),(2,d),(3,c)\}} 
   
 ,或
  
    
      
        f 
        ( 
        x 
        ) 
        = 
        
          { 
          
            
              
                
                  d 
                  , 
                 
                
                  
                    
                      if  
                     
                   
                  x 
                  = 
                  1 
                
              
              
                
                  d 
                  , 
                 
                
                  
                    
                      if  
                     
                   
                  x 
                  = 
                  2 
                 
               
              
                
                  c 
                  , 
                 
                
                  
                    
                      if  
                     
                   
                  x 
                  = 
                  3 
                 
               
            
          
          {\displaystyle f(x)=\left\{{\begin{matrix}d,&{\mbox{if }}x=1\\d,&{\mbox{if }}x=2\\c,&{\mbox{if }}x=3\end{matrix}}\right.} 
          
 除了正式定義 一節所規範的集合論表示法,一般的數學書籍會採用比較通俗的函數表記方法,下面將一一介紹。
很多函數都是取实数 為輸出值和輸入值,換句話說,都是
  
    
      
        f 
        : 
        A 
        → 
        
          R 
         
       
     
    {\displaystyle f:A\to \mathbb {R} } 
   
 
  
    
      
        A 
        ⊆ 
        
          R 
         
       
     
    {\displaystyle A\subseteq \mathbb {R} } 
   
 实数加法 可由皮亚诺公理 裡的單元函數符號 
  
    
      
        S 
        ( 
        x 
        ) 
       
     
    {\displaystyle S(x)} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        x 
        + 
        1 
       
     
    {\displaystyle x+1} 
   
 建構出來 ,或被視為实数公理系統 裡的雙元函數符號 
  
    
      
        P 
        ( 
        x 
        , 
        y 
        ) 
       
     
    {\displaystyle P(x,\,y)} 
   
 
  
    
      
        x 
        + 
        y 
       
     
    {\displaystyle x+y} 
   
 一阶逻辑 下的項 ;類似地,其他四則運算也可以此類推,而得出他們都是項 的結論。所以直觀上定義实数 函數的時候,都希望一條項(直觀上的運算式)能唯一決定一個函數,比如說,對於項 :
  
    
      
        x 
        + 
        1 
       
     
    {\displaystyle x+1} 
   
 以下的集合:
  
    
      
        h 
        := 
        
          
            { 
           
         
        p 
        
          
            | 
           
         
        ( 
        ∃ 
        x 
        ∈ 
        
          R 
         
        ) 
        [ 
        p 
        = 
        ( 
        x 
        , 
        x 
        + 
        1 
        ) 
        ] 
        
          
            } 
           
         
       
     
    {\displaystyle h:={\bigg \{}p\,{\bigg |}\,(\exists x\in \mathbb {R} )[p=(x,\,x+1)]{\bigg \}}} 
   
 是一個函數。為了讓這類函數的表示更加簡潔,就衍伸出以下的表記方式:
符號定義  —  
  
    
      
        
          X 
          
            1 
           
         
        , 
        … 
        , 
        
          X 
          
            n 
           
         
       
     
    {\displaystyle X_{1},\,\dots ,\,X_{n}} 
   
 集合 ,
  
    
      
        T 
       
     
    {\displaystyle T} 
   
 
  
    
      
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
       
     
    {\displaystyle x_{1},\,\dots ,\,x_{n}} 
   
 項 ,那在:
  
    
      
        ( 
        ∀ 
        
          x 
          
            1 
           
         
        ∈ 
        
          X 
          
            1 
           
         
        ) 
        … 
        ( 
        ∀ 
        
          x 
          
            n 
           
         
        ∈ 
        
          X 
          
            n 
           
         
        ) 
        ( 
        ∃ 
        ! 
        y 
        ) 
        ( 
        y 
        = 
        T 
        ) 
       
     
    {\displaystyle (\forall x_{1}\in X_{1})\dots (\forall x_{n}\in X_{n})(\exists !y)(y=T)} 
   
 的前提下,則可做以下的符號定義:
  
    
      
        f 
        ( 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ) 
        = 
        T 
        ( 
        ⟨ 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ⟩ 
        ∈ 
        
          X 
          
            1 
           
         
        × 
        ⋯ 
        × 
        
          X 
          
            n 
           
         
        ) 
         
     
    {\displaystyle f(x_{1},\,\dots ,\,x_{n})=T\;\;(\langle x_{1},\,\dots ,\,x_{n}\rangle \in X_{1}\times \dots \times X_{n})\,} 
   
 
  
    
      
        := 
       
     
    {\displaystyle :=} 
   
 
  
    
      
        f 
        = 
        
          
            { 
           
         
        p 
        
          
            | 
           
         
        ∃ 
        
          x 
          
            1 
           
         
        … 
        ∃ 
        
          x 
          
            n 
           
         
        [ 
        ( 
        ⟨ 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ⟩ 
        ∈ 
        
          X 
          
            1 
           
         
        × 
        ⋯ 
        × 
        
          X 
          
            n 
           
         
        ) 
        ∧ 
        ( 
        p 
        = 
        ⟨ 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        , 
        T 
        ⟩ 
        ) 
        ] 
        
          
            } 
           
         
       
     
    {\displaystyle f={\bigg \{}p\,{\bigg |}\,\exists x_{1}\dots \exists x_{n}[(\langle x_{1},\,\dots ,\,x_{n}\rangle \in X_{1}\times \dots \times X_{n})\wedge (p=\langle x_{1},\,\dots ,\,x_{n},\,T\rangle )]{\bigg \}}} 
   
  
這個表記方式被稱為函數記號 (functional notation),直觀上表示「若從
  
    
      
        
          X 
          
            i 
           
         
       
     
    {\displaystyle X_{i}} 
   
 
  
    
      
        
          x 
          
            i 
           
         
       
     
    {\displaystyle x_{i}} 
   
 
  
    
      
        T 
       
     
    {\displaystyle T} 
   
 
  
    
      
        f 
        ( 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ) 
        = 
        T 
       
     
    {\displaystyle f(x_{1},\,\dots ,\,x_{n})=T} 
   
 
  
    
      
        T 
       
     
    {\displaystyle T} 
   
 
  
    
      
        T 
        := 
        
          x 
          
            1 
           
         
        + 
        z 
       
     
    {\displaystyle T:=x_{1}+z} 
   
 
像是取
  
    
      
        T 
       
     
    {\displaystyle T} 
   
 
  
    
      
        x 
        + 
        1 
       
     
    {\displaystyle x+1} 
   
 
  
    
      
        ( 
        ∀ 
        x 
        ∈ 
        
          R 
         
        ) 
        ( 
        ∃ 
        ! 
        y 
        ) 
        ( 
        y 
        = 
        x 
        + 
        1 
        ) 
       
     
    {\displaystyle (\forall x\in \mathbb {R} )(\exists !y)(y=x+1)} 
   
 因為單元對被規定成:
  
    
      
        ⟨ 
        x 
        ⟩ 
        := 
        x 
       
     
    {\displaystyle \langle x\rangle :=x} 
   
 這樣就可以把前面的函數
  
    
      
        h 
       
     
    {\displaystyle h} 
   
 
  
    
      
        h 
        ( 
        x 
        ) 
        = 
        x 
        + 
        1 
        ( 
        x 
        ∈ 
        
          R 
         
        ) 
       
     
    {\displaystyle h(x)=x+1\;(x\in \mathbb {R} )} 
   
 如果定義域可以從上下文推斷出來,函數記號可以更不正式的寫為:
  
    
      
        f 
        ( 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ) 
        = 
        T 
       
     
    {\displaystyle f(x_{1},\,\dots ,\,x_{n})=T} 
   
 比如說函數
  
    
      
        h 
       
     
    {\displaystyle h} 
   
 
  
    
      
        h 
        ( 
        x 
        ) 
        = 
        x 
        + 
        1 
       
     
    {\displaystyle h(x)=x+1} 
   
 這個記號是1734年第一次被萊昂哈德·歐拉 所採用[ 10] 項 與幂级数 ,因為當時並沒有一阶逻辑 這種清楚研究語言推理的系統;也並不知道有些物理 應用的函數不能用幂级数 展開[ 11] 
以上的函數記號也可以稍作修改,來明確的指出「輸出值」的範圍:
符號定義  —  
  
    
      
        
          X 
          
            1 
           
         
        , 
        … 
        , 
        
          X 
          
            n 
           
         
       
     
    {\displaystyle X_{1},\,\dots ,\,X_{n}} 
   
 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 集合 ,
  
    
      
        T 
       
     
    {\displaystyle T} 
   
 
  
    
      
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
       
     
    {\displaystyle x_{1},\,\dots ,\,x_{n}} 
   
 項 ,在:
  
    
      
        ( 
        ∀ 
        
          x 
          
            1 
           
         
        ∈ 
        
          X 
          
            1 
           
         
        ) 
        … 
        ( 
        ∀ 
        
          x 
          
            n 
           
         
        ∈ 
        
          X 
          
            n 
           
         
        ) 
        ( 
        ∃ 
        ! 
        y 
        ) 
        [ 
        ( 
        y 
        ∈ 
        Y 
        ) 
        ∧ 
        ( 
        y 
        = 
        T 
        ) 
        ] 
       
     
    {\displaystyle (\forall x_{1}\in X_{1})\dots (\forall x_{n}\in X_{n})(\exists !y)[\,(y\in Y)\wedge (y=T)\,]} 
   
 的前提下,可做以下的符號定義:
  
    
      
        f 
        : 
        
          X 
          
            1 
           
         
        × 
        ⋯ 
        × 
        
          X 
          
            n 
           
         
        → 
        Y 
        ; 
        ⟨ 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ⟩ 
        ↦ 
        T 
       
     
    {\displaystyle f:X_{1}\times \dots \times X_{n}\to Y;\;\langle x_{1},\,\dots ,\,x_{n}\rangle \mapsto T} 
   
 
  
    
      
        := 
       
     
    {\displaystyle :=} 
   
 
  
    
      
        f 
        = 
        
          
            { 
           
         
        p 
        
          
            | 
           
         
        ∃ 
        
          x 
          
            1 
           
         
        … 
        ∃ 
        
          x 
          
            n 
           
         
        [ 
        ( 
        ⟨ 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ⟩ 
        ∈ 
        
          X 
          
            1 
           
         
        × 
        ⋯ 
        × 
        
          X 
          
            n 
           
         
        ) 
        ∧ 
        ( 
        p 
        = 
        ⟨ 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        , 
        T 
        ⟩ 
        ) 
        ∧ 
        ( 
        T 
        ∈ 
        Y 
        ) 
        ] 
        
          
            } 
           
         
       
     
    {\displaystyle f={\bigg \{}p\,{\bigg |}\,\exists x_{1}\dots \exists x_{n}[(\langle x_{1},\,\dots ,\,x_{n}\rangle \in X_{1}\times \dots \times X_{n})\wedge (p=\langle x_{1},\,\dots ,\,x_{n},\,T\rangle )\wedge (T\in Y)]{\bigg \}}} 
   
  
這個表記方式被稱為箭號表示 (arrow notation),直觀上表示「若把從
  
    
      
        
          X 
          
            i 
           
         
       
     
    {\displaystyle X_{i}} 
   
 
  
    
      
        
          x 
          
            i 
           
         
       
     
    {\displaystyle x_{i}} 
   
 
  
    
      
        T 
       
     
    {\displaystyle T} 
   
 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 
  
    
      
        X 
       
     
    {\displaystyle X} 
   
 
  
    
      
        Y 
       
     
    {\displaystyle Y} 
   
 
  
    
      
        ⟨ 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ⟩ 
        ↦ 
        T 
       
     
    {\displaystyle \langle x_{1},\,\dots ,\,x_{n}\rangle \mapsto T} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
上述符號也可以比較通俗地記為:
  
    
      
        f 
        : 
        
          X 
          
            1 
           
         
        × 
        ⋯ 
        × 
        
          X 
          
            n 
           
         
        → 
        Y 
        ; 
        f 
        ( 
        
          x 
          
            1 
           
         
        , 
        … 
        , 
        
          x 
          
            n 
           
         
        ) 
        = 
        T 
       
     
    {\displaystyle f:X_{1}\times \dots \times X_{n}\to Y;\;f(x_{1},\,\dots ,\,x_{n})=T} 
   
 比如說,取
  
    
      
        
          T 
          
            x 
           
         
       
     
    {\displaystyle T_{x}} 
   
 
  
    
      
        x 
        + 
        1 
       
     
    {\displaystyle x+1} 
   
 
  
    
      
        ( 
        ∀ 
        x 
        ∈ 
        
          R 
         
        ) 
        ( 
        ∃ 
        ! 
        y 
        ) 
        [ 
        ( 
        y 
        ∈ 
        
          R 
         
        ) 
        ∧ 
        ( 
        y 
        = 
        x 
        + 
        1 
        ) 
        ] 
       
     
    {\displaystyle (\forall x\in \mathbb {R} )(\exists !y)[(y\in \mathbb {R} )\wedge (y=x+1)]} 
   
 因為
  
    
      
        x 
        ∈ 
        
          R 
         
       
     
    {\displaystyle x\in \mathbb {R} } 
   
 
  
    
      
        x 
        + 
        1 
        ∈ 
        
          R 
         
       
     
    {\displaystyle x+1\in \mathbb {R} } 
   
 
  
    
      
        h 
       
     
    {\displaystyle h} 
   
 
  
    
      
        h 
        : 
        
          R 
         
        → 
        
          R 
         
        ; 
        h 
        ( 
        x 
        ) 
        = 
        x 
        + 
        1 
       
     
    {\displaystyle h:\mathbb {R} \to \mathbb {R} ;\;h(x)=x+1} 
   
 箭號表示常用來「固定」某個變數,來得到新的函數;假設
  
    
      
        
          T 
          
            x 
            t 
           
         
       
     
    {\displaystyle T_{xt}} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 
  
    
      
        t 
       
     
    {\displaystyle t} 
   
 項 ,如果:
  
    
      
        f 
        : 
        X 
        × 
        T 
        → 
        Y 
        ; 
        ( 
        x 
        , 
        t 
        ) 
        ↦ 
        
          T 
          
            x 
            t 
           
         
       
     
    {\displaystyle f:X\times T\to Y;\;(x,t)\mapsto T_{xt}} 
   
 
  
    
      
        τ 
        ∈ 
        T 
       
     
    {\displaystyle \tau \in T} 
   
 那根據:
  
    
      
        ( 
        ∀ 
        x 
        ) 
        ( 
        ∀ 
        y 
        ) 
        ( 
        ∀ 
        
          x 
          
            ′ 
           
         
        ) 
        ( 
        ∀ 
        
          y 
          
            ′ 
           
         
        ) 
        { 
        ( 
        ⟨ 
        x 
        , 
        y 
        ⟩ 
        = 
        ⟨ 
        
          x 
          
            ′ 
           
         
        , 
        
          y 
          
            ′ 
           
         
        ⟩ 
        ) 
        ⇔ 
        [ 
        ( 
        x 
        = 
        x 
        ) 
        ∧ 
        ( 
        
          y 
          
            ′ 
           
         
        = 
        
          y 
          
            ′ 
           
         
        ) 
        ] 
        } 
       
     
    {\displaystyle (\forall x)(\forall y)(\forall x^{\prime })(\forall y^{\prime })\{(\langle x,y\rangle =\langle x^{\prime },y^{\prime }\rangle )\Leftrightarrow [(x=x)\wedge (y^{\prime }=y^{\prime })]\}} 
   
 若假設
  
    
      
        
          T 
          
            x 
            τ 
           
         
       
     
    {\displaystyle T_{x\tau }} 
   
 
  
    
      
        
          T 
          
            x 
            t 
           
         
       
     
    {\displaystyle T_{xt}} 
   
 
  
    
      
        t 
       
     
    {\displaystyle t} 
   
 
  
    
      
        τ 
       
     
    {\displaystyle \tau } 
   
 項 ,那以下的符號簡寫也是可行的:
  
    
      
        
          f 
          
            τ 
           
         
        : 
        X 
        → 
        Y 
        ; 
        x 
        ↦ 
        
          T 
          
            x 
            τ 
           
         
       
     
    {\displaystyle f_{\tau }:X\to Y;\;x\mapsto T_{x\tau }} 
   
 直觀上來說,
  
    
      
        
          f 
          
            τ 
           
         
       
     
    {\displaystyle f_{\tau }} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        t 
       
     
    {\displaystyle t} 
   
 
  
    
      
        τ 
       
     
    {\displaystyle \tau } 
   
 partial applied function 
可以把箭號表示裡的
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 间隔号 ,變成更通俗直觀的間隔號表示 ,比如說:
  
    
      
        f 
        : 
        
          R 
         
        → 
        
          R 
         
        ; 
        x 
        ↦ 
        
          x 
          
            2 
           
         
       
     
    {\displaystyle f:\mathbb {R} \to \mathbb {R} ;\;x\mapsto x^{2}} 
   
 可以記為:
  
    
      
        
          
            ( 
            ⋅ 
            ) 
           
          
            2 
           
         
       
     
    {\displaystyle {(\cdot )}^{2}} 
   
 或是對於
  
    
      
        [ 
        a 
        , 
        b 
        ] 
       
     
    {\displaystyle [a,\,b]} 
   
 可積 的
  
    
      
        f 
        : 
        [ 
        a 
        , 
        b 
        ] 
        → 
        
          R 
         
       
     
    {\displaystyle f:[a,\,b]\to \mathbb {R} } 
   
 
  
    
      
        g 
        : 
        [ 
        a 
        , 
        b 
        ] 
        → 
        
          R 
         
        ; 
        x 
        ↦ 
        
          ∫ 
          
            a 
           
          
            x 
           
         
        f 
        ( 
        u 
        ) 
        d 
        u 
       
     
    {\displaystyle g:[a,\,b]\to \mathbb {R} ;\;x\mapsto \int _{a}^{x}f(u)\,du} 
   
 函數
  
    
      
        g 
       
     
    {\displaystyle g} 
   
 
  
    
      
        
          ∫ 
          
            a 
           
          
            ( 
            ⋅ 
            ) 
           
         
        f 
        ( 
        u 
        ) 
        d 
        u 
       
     
    {\displaystyle \int _{a}^{(\cdot )}f(u)\,du} 
   
 但這個表記方法的明顯缺點是無法指出定義域,因為函數於哪個區間 可積 會決定以上的函數
  
    
      
        g 
       
     
    {\displaystyle g} 
   
 
如果函數
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 實函数 ),可以x軸代表定義域的範圍;y軸代表值域的範圍,把函數的每個元素標示在平面直角坐標 上,這被稱為實函数
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 函數圖形 。
對於「雙變數」的實函數
  
    
      
        g 
       
     
    {\displaystyle g} 
   
 
  
    
      
        x 
        , 
        y 
        , 
        z 
        ∈ 
        
          R 
         
       
     
    {\displaystyle x,\,y,\,z\in \mathbb {R} } 
   
 
  
    
      
        ( 
        ( 
        x 
        , 
        y 
        ) 
        , 
        z 
        ) 
       
     
    {\displaystyle ((x,\,y),\,z)} 
   
 為元素的函數,可以取
  
    
      
        
          D 
          
            x 
           
         
        = 
        { 
        x 
        
          | 
         
        ( 
        ∃ 
        y 
        ) 
        ( 
        ∃ 
        z 
        ) 
        [ 
        g 
        ( 
        x 
        , 
        y 
        ) 
        = 
        z 
        ] 
        } 
       
     
    {\displaystyle D_{x}=\{\,x\,|\,(\exists y)(\exists z)[\,g(x,\,y)=z\,]\,\}} 
   
 
  
    
      
        
          D 
          
            y 
           
         
        = 
        { 
        x 
        
          | 
         
        ( 
        ∃ 
        x 
        ) 
        ( 
        ∃ 
        z 
        ) 
        [ 
        g 
        ( 
        x 
        , 
        y 
        ) 
        = 
        z 
        ] 
        } 
       
     
    {\displaystyle D_{y}=\{\,x\,|\,(\exists x)(\exists z)[\,g(x,\,y)=z\,]\,\}} 
   
 然後以x軸為
  
    
      
        
          D 
          
            x 
           
         
       
     
    {\displaystyle D_{x}} 
   
 
  
    
      
        
          D 
          
            y 
           
         
       
     
    {\displaystyle D_{y}} 
   
 
  
    
      
        g 
       
     
    {\displaystyle g} 
   
 直角坐標 繪出
  
    
      
        g 
       
     
    {\displaystyle g} 
   
 函數圖形 。
平面上的任意圖形可用豎直判别法 判斷是否為實函数 的圖形,即图形与任何一条平行于y轴的直线不能有一个以上的交點。但實際上這僅僅是函數正式定義的一種應用,因為平行于y轴的直线代表的是形如 
  
    
      
        { 
        p 
        ∈ 
        
          
            
              R 
             
           
          
            2 
           
         
        
          | 
         
        ( 
        ∃ 
        y 
        ∈ 
        
          R 
         
        ) 
        [ 
        p 
        = 
        ( 
        c 
        , 
        y 
        ) 
        ] 
        } 
       
     
    {\displaystyle \{\,p\in {\mathbb {R} }^{2}\,|\,(\exists y\in \mathbb {R} )[\,p=(c,\,y)\,]\,\}} 
   
 的集合,也就是此直線交x軸於
  
    
      
        ( 
        c 
        , 
        0 
        ) 
       
     
    {\displaystyle (c,\,0)} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        { 
        p 
        ∈ 
        
          
            
              R 
             
           
          
            2 
           
         
        
          | 
         
        ( 
        ∃ 
        y 
        ∈ 
        
          R 
         
        ) 
        [ 
        p 
        = 
        ( 
        c 
        , 
        y 
        ) 
        ∧ 
        y 
        = 
        f 
        ( 
        c 
        ) 
        ] 
        } 
       
     
    {\displaystyle \{\,p\in {\mathbb {R} }^{2}\,|\,(\exists y\in \mathbb {R} )[\,p=(c,\,y)\wedge y=f(c)\,]\,\}} 
   
 而屬於這個交集裡的平面點最多只能有一個 ,否則就會跟每個
  
    
      
        x 
        ∈ 
        
          D 
          
            f 
           
         
       
     
    {\displaystyle x\in D_{f}} 
   
 
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
 
像 
第一種是形如
  
    
      
        f 
        ( 
        x 
        ) 
       
     
    {\displaystyle f(x)} 
   
 項 ,直觀上代表的是依照函數
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 函數值的簡記 )
第二種指的是集合
  
    
      
        A 
       
     
    {\displaystyle A} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        f 
        ( 
        A 
        ) 
       
     
    {\displaystyle f(A)} 
   
 
  
    
      
        f 
        ( 
        A 
        ) 
        := 
        { 
        y 
        
          | 
         
        ( 
        ∃ 
        x 
        ∈ 
        A 
        ) 
        [ 
        y 
        = 
        f 
        ( 
        x 
        ) 
        ] 
        } 
       
     
    {\displaystyle f(A):=\{\,y\,|\,(\exists x\in A)[\,y=f(x)\,]\,\}} 
   
 注意
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        
          D 
          
            f 
           
         
       
     
    {\displaystyle D_{f}} 
   
 
  
    
      
        f 
        ( 
        
          D 
          
            f 
           
         
        ) 
       
     
    {\displaystyle f(D_{f})} 
   
 正式定義 一節的最後例子中,
  
    
      
        { 
        2 
        , 
        3 
        } 
       
     
    {\displaystyle \{2,3\}} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        f 
        ( 
        { 
        2 
        , 
        3 
        } 
        ) 
        = 
        { 
        c 
        , 
        d 
        } 
       
     
    {\displaystyle f(\{2,3\})=\{c,d\}} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        { 
        c 
        , 
        d 
        } 
       
     
    {\displaystyle \{c,d\}} 
   
 
類似的,集合
  
    
      
        B 
       
     
    {\displaystyle B} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 原像 (或逆像 )定義為:
  
    
      
        
          f 
          
            − 
            1 
           
         
        ( 
        B 
        ) 
        := 
        { 
        x 
        
          | 
         
        ( 
        ∃ 
        y 
        ) 
        [ 
        y 
        = 
        f 
        ( 
        x 
        ) 
        ∧ 
        y 
        ∈ 
        B 
        ] 
        } 
       
     
    {\displaystyle f^{-1}(B):=\{\,x\,|\,(\exists y)[\,y=f(x)\wedge y\in B\,]\,\}} 
   
 沿用同一例子,可以看到
  
    
      
        { 
        a 
        , 
        b 
        } 
       
     
    {\displaystyle \{a,b\}} 
   
 
  
    
      
        
          f 
          
            − 
            1 
           
         
        ( 
        { 
        a 
        , 
        b 
        } 
        ) 
        = 
        ∅ 
       
     
    {\displaystyle f^{-1}(\{a,b\})=\varnothing } 
   
 空集 。
以下是
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        
          f 
          
            − 
            1 
           
         
       
     
    {\displaystyle f^{-1}} 
   
 
  
    
      
        f 
        ( 
        
          A 
          
            1 
           
         
        ∪ 
        
          A 
          
            2 
           
         
        ) 
        = 
        f 
        ( 
        
          A 
          
            1 
           
         
        ) 
        ∪ 
        f 
        ( 
        
          A 
          
            2 
           
         
        ) 
       
     
    {\displaystyle f(A_{1}\cup A_{2})=f(A_{1})\cup f(A_{2})} 
   
 
  
    
      
        f 
        ( 
        
          A 
          
            1 
           
         
        ∩ 
        
          A 
          
            2 
           
         
        ) 
        ⊆ 
        f 
        ( 
        
          A 
          
            1 
           
         
        ) 
        ∩ 
        f 
        ( 
        
          A 
          
            2 
           
         
        ) 
       
     
    {\displaystyle f(A_{1}\cap A_{2})\subseteq f(A_{1})\cap f(A_{2})} 
   
 
  
    
      
        f 
        ( 
        
          B 
          
            1 
           
         
        ∪ 
        
          B 
          
            2 
           
         
        ) 
        = 
        
          f 
          
            − 
            1 
           
         
        ( 
        
          B 
          
            1 
           
         
        ) 
        ∪ 
        
          f 
          
            − 
            1 
           
         
        ( 
        
          B 
          
            2 
           
         
        ) 
       
     
    {\displaystyle f(B_{1}\cup B_{2})=f^{-1}(B_{1})\cup f^{-1}(B_{2})} 
   
 
  
    
      
        
          f 
          
            − 
            1 
           
         
        ( 
        
          B 
          
            1 
           
         
        ∩ 
        
          B 
          
            2 
           
         
        ) 
        = 
        
          f 
          
            − 
            1 
           
         
        ( 
        
          B 
          
            1 
           
         
        ) 
        ∩ 
        
          f 
          
            − 
            1 
           
         
        ( 
        
          B 
          
            2 
           
         
        ) 
       
     
    {\displaystyle f^{-1}(B_{1}\cap B_{2})=f^{-1}(B_{1})\cap f^{-1}(B_{2})} 
   
 
  
    
      
        
          f 
          
            − 
            1 
           
         
        ( 
        f 
        ( 
        B 
        ) 
        ) 
        ⊆ 
        B 
       
     
    {\displaystyle f^{-1}(f(B))\subseteq B} 
   
 
  
    
      
        
          f 
          
            − 
            1 
           
         
        ( 
        f 
        ( 
        A 
        ) 
        ) 
        ⊇ 
        A 
       
     
    {\displaystyle f^{-1}(f(A))\supseteq A} 
   
 這些特性適合定義域的任意子集
  
    
      
        A 
        , 
        
          A 
          
            1 
           
         
       
     
    {\displaystyle A,A_{1}} 
   
 
  
    
      
        
          A 
          
            2 
           
         
       
     
    {\displaystyle A_{2}} 
   
 子集 
  
    
      
        B 
        , 
        
          B 
          
            1 
           
         
       
     
    {\displaystyle B,B_{1}} 
   
 
  
    
      
        
          B 
          
            2 
           
         
       
     
    {\displaystyle B_{2}} 
   
 交集 和并集 。
若
  
    
      
        f 
        : 
        X 
        → 
        Y 
       
     
    {\displaystyle f:X\to Y} 
   
 
  
    
      
        
          X 
          
            ′ 
           
         
        ⊂ 
        X 
       
     
    {\displaystyle X^{\prime }\subset X} 
   
 
  
    
      
        f 
        
          
            | 
           
          
            
              X 
              
                ′ 
               
             
           
         
       
     
    {\displaystyle f|_{X^{\prime }}} 
   
 
  
    
      
        × 
       
     
    {\displaystyle \times } 
   
 笛卡儿积 )
  
    
      
        f 
        
          
            | 
           
          
            
              X 
              
                ′ 
               
             
           
         
        := 
        
          
            { 
           
         
        ( 
        x 
        , 
        y 
        ) 
        
          
            | 
           
         
        ( 
        x 
        ∈ 
        
          X 
          
            ′ 
           
         
        ) 
        ∧ 
        [ 
        y 
        = 
        f 
        ( 
        x 
        ) 
        ] 
        
          
            } 
           
         
        = 
        f 
        ∩ 
        ( 
        
          X 
          
            ′ 
           
         
        × 
        Y 
        ) 
       
     
    {\displaystyle f|_{X^{\prime }}:={\bigg \{}\,(x,\,y)\,{\bigg |}\,(x\in X^{\prime })\wedge [\,y=f(x)\,]\,{\bigg \}}=f\cap (X^{\prime }\times Y)} 
   
 顯然為一函數,稱為
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        
          X 
          
            ′ 
           
         
       
     
    {\displaystyle X^{\prime }} 
   
 限制 
反之,若
  
    
      
        g 
        : 
        X 
        → 
        Z 
       
     
    {\displaystyle g:X\to Z} 
   
 
  
    
      
        X 
        ⊆ 
        Y 
       
     
    {\displaystyle X\subseteq Y} 
   
 
  
    
      
        f 
        : 
        Y 
        → 
        Z 
       
     
    {\displaystyle f:Y\to Z} 
   
 
  
    
      
        f 
        
          
            | 
           
          
            X 
           
         
        = 
        g 
       
     
    {\displaystyle f|_{X}=g} 
   
 
  
    
      
        f 
       
     
    {\displaystyle f} 
   
 
  
    
      
        g 
       
     
    {\displaystyle g} 
   
 擴張 
通常希望擴張後的函數為解析函數 ,因為代數性質 良好。這種擴張稱為解析延拓 。
設
  
    
      
        f 
        : 
        X 
        → 
        R 
       
     
    {\displaystyle f:X\to R} 
   
 
  
    
      
        g 
        : 
        X 
        → 
        R 
       
     
    {\displaystyle g:X\to R} 
   
 
  
    
      
        ( 
        R 
        , 
        + 
        , 
        × 
        ) 
       
     
    {\displaystyle (R,\,+,\,\times )} 
   
 環 。這樣可以定義「函數和」
  
    
      
        f 
        + 
        g 
       
     
    {\displaystyle f+g} 
   
 
  
    
      
        f 
        × 
        g 
       
     
    {\displaystyle f\times g} 
   
 
  
    
      
        
          
            
              
                f 
                + 
                g 
                := 
                
                  
                    { 
                   
                 
                ( 
                x 
                , 
                y 
                ) 
                
                  
                    | 
                   
                 
                ( 
                x 
                ∈ 
                X 
                ) 
                ∧ 
                [ 
                y 
                = 
                f 
                ( 
                x 
                ) 
                + 
                g 
                ( 
                x 
                ) 
                ] 
                
                  
                    } 
                   
                 
               
             
           
         
       
     
    {\displaystyle {\begin{aligned}f+g:={\bigg \{}\,(x,\,y)\,{\bigg |}\,(x\in X)\wedge [\,y=f(x)+g(x)\,]\,{\bigg \}}\\\end{aligned}}} 
   
 
  
    
      
        
          
            
              
                f 
                + 
                g 
                := 
                
                  
                    { 
                   
                 
                ( 
                x 
                , 
                y 
                ) 
                
                  
                    | 
                   
                 
                ( 
                x 
                ∈ 
                X 
                ) 
                ∧ 
                [ 
                y 
                = 
                f 
                ( 
                x 
                ) 
                × 
                g 
                ( 
                x 
                ) 
                ] 
                
                  
                    } 
                   
                 
               
             
           
         
       
     
    {\displaystyle {\begin{aligned}f+g:={\bigg \{}\,(x,\,y)\,{\bigg |}\,(x\in X)\wedge [\,y=f(x)\times g(x)\,]\,{\bigg \}}\\\end{aligned}}} 
   
 很容易證明以上兩者也是函數,類似的對任意的
  
    
      
        r 
        ∈ 
        R 
       
     
    {\displaystyle r\in R} 
   
 
  
    
      
        
          
            
              
                
                  r 
                  
                    R 
                   
                 
                := 
                
                  
                    { 
                   
                 
                ( 
                x 
                , 
                y 
                ) 
                
                  
                    | 
                   
                 
                ( 
                x 
                ∈ 
                X 
                ) 
                ∧ 
                ( 
                y 
                = 
                r 
                ) 
                
                  
                    } 
                   
                 
               
             
           
         
       
     
    {\displaystyle {\begin{aligned}r_{R}:={\bigg \{}\,(x,\,y)\,{\bigg |}\,(x\in X)\wedge (y=r)\,{\bigg \}}\\\end{aligned}}} 
   
 
  
    
      
        
          
            
              
                r 
                ⋅ 
                f 
                := 
                
                  
                    { 
                   
                 
                ( 
                x 
                , 
                y 
                ) 
                
                  
                    | 
                   
                 
                ( 
                x 
                ∈ 
                X 
                ) 
                ∧ 
                [ 
                y 
                = 
                r 
                × 
                f 
                ( 
                x 
                ) 
                ] 
                
                  
                    } 
                   
                 
               
             
           
         
       
     
    {\displaystyle {\begin{aligned}r\cdot f:={\bigg \{}\,(x,\,y)\,{\bigg |}\,(x\in X)\wedge [\,y=r\times f(x)\,]\,{\bigg \}}\\\end{aligned}}} 
   
 也是函數,其中
  
    
      
        
          r 
          
            R 
           
         
       
     
    {\displaystyle r_{R}} 
   
 常數函數 。
首都之於国家(若不把多首都国[ 註 1]  
每个自然数 
  
    
      
        n 
       
     
    {\displaystyle n} 
   
 
  
    
      
        
          n 
          
            2 
           
         
       
     
    {\displaystyle n^{2}} 
   
 
  
    
      
        n 
       
     
    {\displaystyle n} 
   
  
對數函數 。
  
    
      
        ln 
         
        x 
       
     
    {\displaystyle \ln x} 
   
 正 实数 
  
    
      
        x 
       
     
    {\displaystyle x} 
   
 對每个在
  
    
      
        
          
            R 
           
          
            2 
           
         
       
     
    {\displaystyle \mathbb {R} ^{2}} 
   
 原点 
  
    
      
        ( 
        0 
        , 
        0 
        ) 
       
     
    {\displaystyle (0,0)} 
   
  常用的数学函数包括多项式函數 、根式函數 、冪函數 、对数函數 、有理函数 、三角函数 、反三角函數 等。它们都是初等函数 。非初等函数(或特殊函数 )包括伽马函數 和贝塞尔函数 等。
函數可分為
在范畴论 中,函数的槪念被推廣為態射 的槪念。
一個范畴 包括一組物件與一組態射,每一個態射是個三元组(X , Y , f ),X 稱為源物件(定義域的類比),Y 稱為目標物件(到達域的類比),而源物件与目標物件是范畴內的物件。基于这种解释,可以把函数看作集合范畴 裡面的態射。
^ 1.0 1.1   Halmos, Paul R.  Naive Set Theory . Springer-Verlag. 1970. ISBN  978-0-387-90092-6  ^ Halmos 1970 ,第30頁[ 1] map , mapping , transformation , correspondence , and operator  are often used synonymously.^ Halmos 1970 [ 1] ^ Mapping , 数学百科全书 , EMS Press , 2001 (英语)   ^ 普通高中教科书 数学 必修 第一册. 上海市: 上海教育出版社. 2020: 114. ISBN  978-7-5720-0183-3“函数”(function)一词作为数学概念首先由莱布尼茨引入    ^ Function , 数学百科全书 , EMS Press , 2001 (英语)   ^ Taalman, Laura; Kohn, Peter. Calculus . New York City : W. H. Freeman and Company . 2014. ISBN  978-1-4292-4186-1LCCN 2012947365 OCLC 856545590 OL 27544563M (英语) .   ^ Trench, William F. Introduction to Real Analysis  2.04th. Pearson Education  (originally; self-republished by the author). 2013  [2023-12-08 ] . ISBN  0-13-045786-8LCCN 2002032369 OCLC 953799815 Zbl 1204.00023 存档 于2023-11-23) (英语) .   ^ Thomson, Brian S.; Bruckner, Judith B.; Bruckner, Andrew M. Elementary Real Analysis  (PDF)  2nd. Prentice Hall  (originally; 2nd ed. self-republished by the authors). 2008  [2023-12-08 ] . ISBN  978-1-4348-4367-8OCLC 1105855173 OL 31844948M Zbl 0872.26001 存档  (PDF) 于2023-05-26) (英语) .   ^ Larson, Ron; Edwards, Bruce H. Calculus of a Single Variable. Cengage Learning. 2010: 19. ISBN  978-0-538-73552-0   ^ 曹, 亮吉. 數學導論. 科學月科社. 1988: 270–270, 277–277.     
 
Anton, Howard. Calculus with Analytical Geometry Wiley . 1980. ISBN  978-0-471-03248-9   Bartle, Robert G. The Elements of Real Analysis  2nd. Wiley. 1976. ISBN  978-0-471-05464-1   Dubinsky, Ed; Harel, Guershon. The Concept of Function: Aspects of Epistemology and Pedagogy . Mathematical Association of America. 1992. ISBN  978-0-88385-081-7   Hammack, Richard. 12. Functions  (PDF) . Book of Proof . Virginia Commonwealth University . 2009  [2012-08-01 ] . (原始内容存档 于2024-06-08).   Husch, Lawrence S. Visual Calculus . University of Tennessee . 2001  [2007-09-27 ] . (原始内容存档 于2011-09-24).   Katz, Robert. Axiomatic Analysis. D. C. Heath and Company . 1964.   Kleiner, Israel. Evolution of the Function Concept: A Brief Survey . The College Mathematics Journal. 1989, 20  (4): 282–300. CiteSeerX 10.1.1.113.6352 JSTOR 2686848 doi:10.2307/2686848    Lützen, Jesper. Between rigor and applications: Developments in the concept of function in mathematical analysis . Porter, Roy  (编). The Cambridge History of Science: The modern physical and mathematical sciences. Cambridge University Press. 2003. ISBN  978-0-521-57199-9   Malik, M. A. Historical and pedagogical aspects of the definition of function. International Journal of Mathematical Education in Science and Technology. 1980, 11  (4): 489–492. doi:10.1080/0020739800110404    Reichenbach, Hans. Elements of Symbolic Logic. Dover. 1947. ISBN  0-486-24004-5   Ruthing, D. Old Intelligencer: Some definitions of the concept of function from Bernoulli, Joh. to Bourbaki, N. . Mathematical Intelligencer. 1984, 6  (4): 71–78. S2CID 189883712 doi:10.1007/BF03026743    Thomas, George B.; Finney, Ross L. Calculus and Analytic Geometry Addison-Wesley . 1995. ISBN  978-0-201-53174-9