이산수학(Discrete Mathematics)
재귀 호출 (Recursion)
2013년 봄학기
강원대학교 컴퓨터과학전공 문양세
Recursive Definitions (재귀의 정의)
3.4 Recursion
In induction, we prove all members of an infinite set have some
property P by proving the truth for larger members in terms of that of
smaller members.
(귀납적 정의에서는, “무한 집합의 모든 멤버가 어떠한 성질 P를 가짐”을 보이기
위하여, “작은 멤버들을 사용하여 큰 멤버들이 참(P의 성질을 가짐)임”을 증명하
는 방법을 사용하였다.)
In recursive definitions, we similarly define a function, a predicate or
a set over an infinite number of elements by defining the function or
predicate value or set-membership of larger elements in terms of that
of smaller ones.
(재귀적 정의에서는, “작은 멤버들에 함수/술어/집합을 적용(정의)하여 모든 멤
버들을 정의”하는 방법을 사용한다.)
Page 2
Discrete Mathematics
by Yang-Sae Moon
Recursion (재귀)
3.4 Recursion
Recursion is a general term for the practice of defining an object in
terms of itself (or of part of itself).
(재귀란 객체를 정의하는데 있어서 해당 객체 자신을 사용하는 것을 의미한다.)
An inductive proof establishes the truth of P(n+1) recursively in terms
of P(n).
(귀납적 증명은 P(n+1)이 참임을 증명하기 위하여 재귀적으로 P(n)을 사용하는
것으로 해석할 수 있다.)
There are also recursive algorithms, definitions, functions, sequences,
and sets.
Page 3
Discrete Mathematics
by Yang-Sae Moon
Recursively Defined Functions
3.4 Recursion
Simplest case: One way to define a function f:NS (for
any set S) or series an=f(n) is to:
• Define f(0).
• For n>0, define f(n) in terms of f(0),…,f(n−1).
E.g.: Define the series an :≡ 2n recursively:
• Let a0 :≡ 1.
• For n>0, let an :≡ 2an-1.
Page 4
Discrete Mathematics
by Yang-Sae Moon
Another Example
3.4 Recursion
Suppose we define f(n) for all nN recursively by:
• Let f(0)=3
• For all nN, let f(n+1)=2f(n)+3
What are the values of the following?
• f(1)= 9
f(2)= 21
f(3)= 45 f(4)= 93
Page 5
Discrete Mathematics
by Yang-Sae Moon
Recursive Definition of Factorial
3.4 Recursion
Given an inductive definition of the factorial function
F(n) :≡ n! :≡ 23…n.
• Base case: F(0) :≡ 1
• Recursive part: F(n) :≡ n F(n-1).
− F(1)=1
− F(2)=2
− F(3)=6
Page 6
Discrete Mathematics
by Yang-Sae Moon
The Fibonacci Series
3.4 Recursion
The Fibonacci series fn≥0 is a famous series defined
by:
f0 :≡ 0,
f1 :≡ 1,
fn≥2 :≡ fn−1 + fn−2
0
1 1
2 3
5 8
13
Page 7
Discrete Mathematics
by Yang-Sae Moon
Inductive Proof about Fibonacci Series
3.4 Recursion
Theorem: fn < 2n.
Proof: By induction.
• Base cases: f0 = 0 < 20 = 1
f1 = 1 < 2 1 = 2
• Inductive step: Use 2nd principle of induction (strong induction).
Assume k<n, fk < 2k.
Then fn = fn−1 + fn−2 is < 2n−1 + 2n−2 < 2n−1 + 2n−1 = 2n.
Page 8
Discrete Mathematics
by Yang-Sae Moon
Recursively Defined Sets
3.4 Recursion
An infinite set S may be defined recursively, by giving:
• A small finite set of base elements of S.
(유한 개수의 기본 원소를 제시)
• A rule for constructing new elements of S from previouslyestablished elements. (새로운 원소를 만드는 방법을 제시)
Example: Let 3S, and let x+yS if x,yS.
What is S? (= {3, 6, 9, 12, 15, …})
Page 9
Discrete Mathematics
by Yang-Sae Moon
The Set of All Strings – skip
3.4 Recursion
Given an alphabet , the set * of all strings over can be
recursively defined as:
* ( :≡ “”, the empty string)
w * x → wx *
Page 10
Discrete Mathematics
by Yang-Sae Moon
© Copyright 2025 Paperzz