본문으로 건너뛰기

2. Basic Structures: Sets, Functions, Sequences and Sums

2.1. Sets

Sets

Set(집합)은 순서가 없는 Object들의 모음이다.
Set의 구성요소를 Element라고 하고 Member라고 표현하기도 한다.
Set은 Element를 포함한다.
Notation으로 Set AAaa라는 Element가 포함됨을 나타낼 때 aAa\in A라고 표현하며 Set AA에 포함되지 않을 시 aAa\notin A로 표현한다.

Set을 설명하기 위해 Element들을 나열하거나, Set builder로 표현할 수 있다.

정보

Example

  • Element들을 나열
    • A={a,b,c,d,e},B={1,2,3,4,...}A=\{a,b,c,d,e\}, B=\{1,2,3,4,...\}
  • Set builder
    • C=\{x \in \mathbf{Z^+}\mid x \ is\ odd\ positive\ integer\ less\ than\ 10\}$$$$C=\{x\in a \mid x is odd positive integer less than 10}
Set notationDescriptionList of elements
N\mathbf{N}The set of natural numbersN={0,1,2,3,}\mathbf{N}=\{0,1,2,3,\ldots\}
Z\mathbf{Z}The set of integersZ={,2,1,0,1,2,}\mathbf{Z}=\{\ldots,-2,-1,0,1,2,\ldots\}
Z+\mathbf{Z^+}The set of positive integersZ+={1,2,3,}\mathbf{Z^+}=\{1,2,3,\ldots\}
Q\mathbf{Q}The set of rational numbersQ={p/qpZ,qZ and q0}\mathbf{Q}=\{p/q \mid p\in \mathbf{Z},q\in \mathbf{Z}\ and\ q \not =0\}
R\mathbf{R}The set of real numbers

Computer science에서 Datatype, Type의 개념은 Set의 개념을 기반으로 한다.
Datatype은 Set의 이름, 해당 Element에 대해 수행 가능한 Operation의 Set으로 구성된다.

정보

Example

Boolean's Elements = {0,1}\{0,1\}, Boolean's Operation= AND, OR, NOT

두 Set이 같다는 표현은 Set AA, BB에 대해 x(xAxB)\forall x(x\in A \leftrightarrow x\in B)가 성립할 때 Notation A=BA=B로 표현한다.

Element가 없는 Set을 Empty set(공집합)이나 Null이라고 부르며 Notation으로 { }\{\ \}\empty로 표현한다.

Element가 하나만 있는 Set을 Singleton set(한원소 집합)이라고 부른다.

Set AA, BB에 대해 x(xAxB)\forall x(x\in A\to x\in B)가 성립할 때 AABB의 Subset(부분 집합)이라고 하며 Notation ABA\subseteq B로 표현한다.

Empty set이 아닌 Set은 적어도 두 개의 Subset(Set 본인과 \empty)을 가진다.

  • x(xxS)\forall x(x\in \empty \to x\in S), 즉 \empty은 어떤 Element도 가지지 않기에 xx\in \empty는 항상 False이므로 Vacuous Truth로 인해 Conditional statement xxSx\in \empty \to x\in S는 항상 True로 증명할 수 있다.
  • x(xSxS)\forall x(x\in S\to x\in S)xSx\in S를 Proposition PP라고 가정할 때 Domain xx에 대해 PPP\to P는 항상 True이므로 True로 증명할 수 있다.

Set AA, BB에 대해 x(xAxB)x(xBxA)\forall x(x\in A\to x\in B)\land \exists x(x\in B \land x\not =A)가 성립할 때, 즉 AABBBB 자신을 제외한 Subset일 때 AABB의 Proper subset(진부분 집합)이며 Notation으로 ABABA\subset B\land A\not =B로 표현한다.

Set은 Element로 다른 Set을 가질 수 있다.

정보

Example

A={,{a},{b},{a,b}}={x  x is subset of set{a,b}}A=\{\empty, \{a\},\{b\},\{a, b\}\}=\{x\ \mid\ x\ is\ subset\ of\ set \{a,b\}\}
{a}A,aA\{a\}\in A,a\notin A

Set SS에 대해 서로 다른 Element가 정확히 nn개 존재할 때 nn이 Nonnegative integer라면 SS를 Finite set(유한 집합)이라고 하며 nnSS의 Cardinality(기수)라고 하며 Notation S=n|S|=n으로 표현한다.

Power set

Set SS의 모든 Subset을 Element로 갖는 Set을 SS의 Power set(멱집합)이라고 하며 Notation P(S)P(S)로 표현한다.
Cardinality가 nn인 Set SS의 Power set의 Cardinality는 2n2^n이다.

정보

Example

{0,1,2}\{0, 1, 2\}의 Powerset
P({0,1,2})={,{0},{1},{2},{0,1},{0,2},{1,2},{0,1,2}}P(\{0,1,2\})=\{\empty , \{0\} ,\{1\} ,\{2\} ,\{0,1\} ,\{0,2\} ,\{1,2\} ,\{0,1,2\}\}
P({0,1,2})=8=23P(\{0,1,2\})=8=2^3\

Cartesian Products

Collection은 Set과 달리 Element의 순서가 유의미하다.
Collection을 표현하기 위해 Set과 다른 표현 방법이 필요해 Ordered n-tuple로 표현하며 Ordered 2-tuple을 Ordered pair라고 한다.

Ordered n-tuple인 (a1,a2,,an)(a_1,a_2,\cdots , a_n)a1a_1을 첫 Element, a2a_2를 두 번째 Element, ana_n을 n번째 Element로 갖는 Collection을 뜻한다.

두 Ordered n-tuple이 같다는 것은 각 Ordered n-tuple의 Element가 순서대로 모두 동일하다는 것이다.

정보

Example

Ordered pair (a,b)=(c,d)(a,b)=(c,d)a=ca=c이고 b=db=d라는 뜻이다.

Set AA, BB에 대해 AA, BB의 Cartesian product는 Notation A×BA\times B로 표현한다.
A×B={(a,b)  aAbB}A\times B=\{(a,b)\ \mid\ a\in A\land b\in B\}이며 (a,b)(a, b)는 Ordered pair이다.

정보

Example

A={1,2}, B={a,b,c}A=\{1,2\},\ B=\{a,b,c\}일 때 A×BA\times B

A×B={(1,a),(1,b),(1,c),(2,a),(2,b),(2,c)}A\times B=\{(1,a),(1,b),(1,c),(2,a),(2,b),(2,c)\}

Set AA, BB에 대한 Cartesian product의 Subset RR을 Set AA에서 Set BB로의 Relation이라고 한다.
A×B=B×AA\times B=B\times A이기 위해 A=BA=B=A=B \lor A=\empty \lor B=\empty여야 한다.
Set A1,A2,,AnA_1,A_2,\cdots ,A_n의 Cartesian product는 A1×A2××AnA_1\times A_2\times \cdots \times A_n으로 표기되며 Ordered n-tuple (a1,a2,,an)(a_1,a_2,\cdots ,a_n)으로 구성되며A1×A2××An={(a1,a2,,an)  aiAi,i=1,2,,n}A_1\times A_2\times \cdots \times A_n=\{(a_1,a_2,\cdots ,a_n)\ \mid\ a_i\in A_i, i=1,2,\cdots,n\}로 표현할 수 있다.

Using Set Notation with Quantifiers

Quantifier를 사용하여 Set Notation을 표현할 수 있다.

정보

Example

Set SS에 대한 모든 Element에 대해 P(x)P(x)의 Universal quantification은 xS(P(x))=x(xSP(x))\forall x\in S(P(x))=\forall x(x\in S\to P(x))이고, Existential quantification은 xS(P(x))=x(xSP(x))\exists x\in S(P(x))=\exists x(x\in S\land P(x))이다.

Truth Sets of Quantifiers

Predicate PP와 Domain DD가 주어질 때 PP의 Truth set은 P(x)P(x)가 True인 DD의 Element인 x에 대한 Set P(x)P(x)이며 Notation Ps Truth set={xD  P(x)}P's\ Truth\ set=\{x\in D\ \mid\ P(x)\}이다.

2.2. Set Operations

Set Operations

Union

Union은Set AA, BB에 대해 {x  xAxB}\{x\ \mid\ x\in A\lor x\in B\}일 때 Notation ABA\cup B로 표현한다.

Section

Section은 Set AA, BB에 대해 {x  xAxB}\{x\ \mid\ x\in A\land x\in B\}일 때 Notation ABA\cap B로 표현한다.

Disjoint

Set AA, BB에 대해 AB=A\cap B=\empty일 때 Disjoint라고 한다.

두 Finite Set AA, BB의 Cardinality를 구할 때 AB=A+BAB|A\cup B| =|A|+|B|-|A\cap B|로 구하는데 이를 임의의 수의 Set의 Union으로 일반화한 것을 Principle of inclusion-exclusion이라고 한다.

Difference

두 Finite set A,BA, B에 대해 {xxAxB}\{x\mid x\in A\land x\notin B\}일 때 Notation ABA-B로 표현한다.

Complement

Set UU(Universal set), AA에 대해 UA={xxA}U-A=\{x\mid x\notin A\}일 때 Notation ACA^C로 표현한다.

Set Identities

IdentityName
A=AAU=AA\cup \empty = A\\A\cap U=AIdentity laws
AA=AAA=AA\cup A=A\\A\cap A=AIdempotent laws
AB=BAAB=BAA\cup B= B\cup A\\A\cap B= B\cap ACommutative laws
A(BC)=(AB)(AC)A(BC)=(AB)(AC)A\cap(B\cup C)=(A\cap B)\cup(A\cap C)\\A\cup(B\cap C)=(A\cup B)\cap(A\cup C)Distributive laws
A(AB)=AA(AB)=AA\cup(A\cap B)=A\\A\cap(A\cap B)=AAbsorption laws
AU=UA=A\cup U=U\\A\cap \empty = \emptyDomination laws
(AC)C=A(A^C)^C = AComplementation laws
A(BC)=(AB)CA(BC)=(AB)CA\cup(B\cup C)=(A\cup B)\cup C\\A\cap(B\cap C)=(A\cap B)\cap CAssociative laws
(AB)C=ACBC(AB)C=ACBC(A\cup B)^C = A^C\cap B^C\\(A\cap B)^C=A^C\cup B^CDe Morgan's laws
AAC=UAAC=A\cup A^C=U\\A\cap A^C= \emptyComplement laws

Generalized Unions and Intersections

Union과 Intersection은 Associative law를 만족하기에 순서가 상관이 없다.

Example

여러 Set의 Union은 해당 Set 중 적어도 하나의 Set에 포함된 Element를 포함하는 Set이다.
Set A1,A2,,AnA_1, A_2, \dots, A_n에 대한 Union의 Collection은 A1A2An=i=1nAiA_1\cup A_2\cup \cdots \cup A_n=\bigcup_{i=1}^n A_i이다.

여러 Set의 Intersection은 해당 Set에 모두 포함된 Element를 포함하는 Set이다.
Set A1,A2,,AnA_1,A_2,\dots,A_n에 대항 Intersection의 Collection은 A1An=i=1nAiA_1\cap \cdots \cap A_n=\bigcap_{i=1}^nA_i이다.

Computer Representation of Sets

Computer에서 Set을 표현하는 방법 중 하나는 Set의 Element를 순서 없이 저장하는 것이다.
Union과 Intersection, Difference Operation이 오래걸릴 수 있다.

Computer에서 Universal set UU가 Finite set(Memory size보다 작을 때)일 때 UU의 Element를 임의의 순서대로 저장하는 방법은 Cardinality가 nnUU의 임의의 Element a1,a2,,ana_1,a_2,\dots,a_n으로 나열한 후 길이가 nn인 Bit string(1=T,0=F1=T,0=F)로 나타내며 이를 통해 Union, Intersection, Difference를 쉽게 찾을 수 있다.

2.3. Functions

Set Functions

Set A,BA,B가 Nonempty set일 때 AA에서 BB로의 Functrion ffAA의 각 Element aa에 대해 BB에 정확히 하나의 Element인 bb를 할당하는 것이며 Notation으로 f(a)=bf(a)=b로 표현한다.

만약 f(a)=bf(a)=b가 성립할 때 f:ABf:A\to B로 표현하며 Function은 Mapping이나 Transformation이라고도 불린다.
f(a)=bf(a)=b일 때 Pair (a,b)(a,b)는 Relation에서 aa를 첫 Element로 가지는 Unique ordered pair가 된다.

Function ff가 Set A,BA, B에 대해 AA에서 BB로의 Function일 경우 ffAABB로 Mapping한다고 표현하며 AAff의 Domain, BBff의 Codomain이 되며 bbaa의 Image, aabb의 Preimage라고 한다.

Function을 정의할 때 Function의 Domain, Codomain, Domain의 Element를 Codomain의 Element에 Mapping하는 방식을 지정한다.
만약 두 Function이 동일한 Domain, Codomain, Domain의 Element를 Codomain의 Element에 Mapping하는 결과가 같다면 두 Function은 같다고 하며 Domain이나 Codomain만이 바뀌더라도 두 Function은 같지 않다고 한다.

(f1+f2)(x)=f1(x)+f2(x),(f1f2)(x)=f1(x)f2(x)(f_1+f_2)(x)=f_1(x)+f_2(x), (f_1f_2)(x)=f_1(x)f_2(x)이다.

Function ff가 Set A,BA, B에 대해 AA에서 BB로의 Function일 때 AA의 Subset SS가 존재할 때 Function ff에 의한 SS의 Image는 SS의 Element들의 Image로 구성된 BB의 Subset이다.
SS의 Image는 f(S)f(S)로 표현하며 f(S)={tsS(t=f(s))}={f(s)sS}f(S)=\{t\mid\exists s\in S(t=f(s))\}=\{f(s)\mid s\in S\}이다.

One-to-One and Onto Functions

Injection

One-to-one(=Injective) function은 두 개의 서로 다른 Domain element에 동일한 Value를 할당하지 않는다.
One-to-one function ff에 대해 aba\not=b일 때 f(a)f(b)f(a)\not=f(b)이며 a=ba=b일 때 f(a)=f(b)f(a)=f(b)이다.
ff가 One-to-one임을 표시하는 방식은 Definition의 Implication의 Contrapositive를 취함으로 구할 수 있다.

Function ff가 One-to-one이라는 것을 Quantifier를 통해 ab(f(a)=f(b)a=b)\forall a\forall b(f(a)=f(b)\to a=b)ab(abf(a)f(b))\forall a\forall b(a\not=b \to f(a)\not = f(b))로 나타낼 수 있다.
위 Statement들의 Universe of discourse는 Function의 Domain과 같다.

Function ffab(a<bf(a)f(b))\forall a\forall b(a<b\to f(a)\leq f(b))이면 Increasing function, ab(a<bf(a)f(b))\forall a\forall b(a<b\to f(a)\geq f(b))이면 Decreasing function이라고 하며 각 Statement에 Equal이 빠질 경우 Strictly increasing(decreasing) function이라고 한다.
Strictly increasing function의 경우 One-to-one function이여야 한다.

Surjection

Onto(=Surjective) function은 Range와 Codomain이 같은 Function을 의미한다.
Function ff가 Set AA에서 BB로 가는 경우 ff가 Surjection이기 위해 BB의 모든 Element에 대해 f(a)=bf(a)=b인 Element aa가 존재해야 한다.

Bijection

One-to-one correspondence function은 모든 Element가 One-to-one이며 Onto임을 의미하며 Bijection이라고 한다.

Inverse Functions and Compositions of Functions

Set A,BA, B에 대해 AA에서 BB로 가는 One-to-one correspondence function ff가 존재할 때 ff의 Inverse function은 BB에 속하는 Element bb에 대해 f(a)=bf(a)=b를 만족하는 AA의 유일한 Element aa를 할당하는 Function이며 Notation으로 f1f^{-1}로 표기하며 즉, f(a)=bf(a)=b일 때 f1(b)=af^{-1}(b)=a가 성립한다.

One-to-one correspondence를 Invertible이라고 하며 Inverse function을 정의할 수 있다는 의미이다.
Not invertible의 경우 One-to-one correspondence이지 않음을 의미한다.

Set A,B,CA,B,C에 대해 Function ggAA에서 BB로, ffBB에서 CC로 가는 Function이라고 할 때 Function f,gf, g의 Composite function은 Notation fgf\cdot g로 표기하며 fg(a)=f(g(a))f\cdot g(a)=f(g(a))를 의미한다.

Composition fgf\cdot ggg의 Range가 ff의 Domain의 Subset인 경우에만 정의 가능하다.

The graphs of Functions

Set A,BA,B에 대해 AA에서 BB로의 각 Function에 대해 A×BA\times B의 Pair set을 Function의 Graph라고 한다.
보통 Function의 동작을 이해하는 데 도움이 되도록 그림으로 표현한다.

Function ff를 Set A,BA,B에 대해 AA에서 BB로의 Function이라고 할 때 ff의 Graph는 {(a,b)aAf(a)=b}\{(a,b)\mid a\in A \land f(a)=b\}와 같은 Pair의 Set이며 A×BA\times B의 Subset으로 첫 Entry에 의해 ff가 할당한 BB의 Element와 두 번째 Entry가 같은 Ordered pair를 포함한다.

Some Important Functions

Floor function은 Real number xx에 대해 xx보다 작거나 같은 가장 큰 Integer를 할당하며 Notation x\lfloor x\rfloor로 표현한다.

Ceiling function은 Real number xx에 대해 xx보다 크거나 같은 가장 작은 Integer를 할당하며 Notation x\lceil x\rceil로 표현한다.

Floor and ceiling function's Properties
x=n if and only if nx<n+1\lfloor x\rfloor = n\text{ if and only if } n\leq x<n+1
x=n if and only if x1<nx\lfloor x\rfloor = n\text{ if and only if } x-1 < n \leq x
x=n if and only if n1<xn\lceil x\rceil = n\text{ if and only if } n-1 < x \leq n
x=n if and only if xn<x+1\lceil x\rceil = n\text{ if and only if } x \leq n < x+1
x1<xxx<x+1x-1<\lfloor x\rfloor \leq x\leq \lceil x \rceil < x+1
x+n=x+n\lfloor x+n \rfloor = \lfloor x\rfloor + n
x+n=x+n\lceil x+n \rceil = \lceil x \rceil + n

2.4. Sequences and Summations

Sequences

Sequence는 Ordered list를 나타내기 위해 사용되는 Discrete structure이다.
Sequence는 Integer의 Subset에서 Set SS로의 Function으로 나타내며 Sequence의 특정 Element를 Term이라고 한다.

Geometric progression은 a,ar,ar2,,arn,a, ar, ar^2, \cdots, ar^n,\cdots와 같으며 Inital term은 aa, Common ratio는 rr이다.

Arithmetic progression은 a,a+d,a+2d,,a+nd,a, a+d, a+2d,\cdots,a+nd,\cdots와 같으며 Initail term은 aa, Common difference는 dd이다.

Finite sequence는 String으로도 표현되며, String SS의 길이가 0일 경우 Empty string, Notation λ\lambda로 표현한다.

Special Integer Sequences

Sequence의 Term을 구성하는 Formula를 찾는 데 여러 Term들을 확인하여 추측하는 데 도움이 될 수 있다.
패턴을 찾는 것이 유용한데 아래의 사항들을 고려하는 것이 좋다.

  • 같은 Value가 여러번 연속되는가?
  • 이전 Term에서 같은 Value나 위치에 따라 달라지는 Value를 더하여 Term을 얻는가?
  • 특정한 Value의 수를 Product하여 이전의 Term에서 Term을 얻는가?
  • 이전의 Term을 특정한 방식으로 결합하여 Term을 얻는가?
  • Term 사이에 주기가 존재하는가?
nth TermFirst 10 Terms
n^21, 4, 9, 16, 25, 36, 49, 64, 81, 100, …
n^31, 8, 27, 64, 125, 216, 343, 512, 729, 1000, …
n^41, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, …
2^n2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, …
3^n3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, …
n!1, 2, 6, 120, 720, 5040, 40320, 362880, 3628800, …

Summations

am,am+1,,anam,am+1,\cdots,an의 Summation은 Notation j=mnaj\sum_{j=m}^n a_j로 표현한다.
위 Variable jj를 Index of summation, mm을 Lower limit, nn을 Upper limit이라고 한다.

정보

Theorem

Real number a,ra, r에 대해 r0r\not= 0일 때 j=0narj={arn+1ar1if r1(n+1)aif r=1\sum_{j=0}^nar^j=\begin{cases}\frac{ar^{n+1}-a}{r-1}&\text{if }r\not=1\\(n+1)a&\text{if }r=1\end{cases}이다.

  • Proof
    S=j=0narjS=\sum_{j=0}^nar^j로 치환하여 아래의 식을 전개한다.
    rS=rj=0narj=j=0narj+1=k=1n+1ark=(sumk=0nark)+(arn+1a)=S+(arn+1a)rS =r\sum_{j=0}^nar^j\\ =\sum_{j=0}^nar^{j+1}\\ =\sum_{k=1}^{n+1}ar^k\\ =(sum_{k=0}^nar^k)+(ar^{n+1}-a)\\ =S+(ar^{n+1}-a)
SumClosed Form
k=0nark(r0)\sum_{k=0}^nar^k(r\not=0)arn+1ar1,r1\frac{ar^n+1-a}{r-1},r\not=1
sumk=1nksum_{k=1}^nkn(n+1)2\frac{n(n+1)}{2}
k=1nk2\sum_{k=1}^nk^2n(n+1)(2n+1)6\frac{n(n+1)(2n+1)}{6}
k=1nk3\sum_{k=1}^nk^3n2(n+1)24\frac{n^2(n+1)^2}{4}
k=0xk,x<1\sum_{k=0}^\infin x^k,\|x\|\lt 111x\frac{1}{1-x}
k=1kxk1,x<1\sum_{k=1}kx^{k-1},\|x\|\lt 11(1x)2\frac{1}{(1-x)^2}

Cardinality

Set A,BA, BAA에서 BB로의 One-to-one coresspondence가 존재할 때만 같은 Cardinality를 가진다.
Infinite set을 Natural number set과 같은 Cardinality를 가진 Set과 다른 Set으로 나누게 되는데 이 때 Finite set이거나 Positive integer와 같은 Cardinality를 가진 Set을 Countable, 그렇지 않은 Set을 Uncountable set이라고 부른다.
Infinite set SS가 Countable일 때 SS의 Cardinality를 0\aleph_0로 표현하며 즉, Notation으로 S=0|S|=\aleph_0로 표기하고 SS의 Cardinality가 Aleph null이라고 한다.

Infinite set은 Set의 Element를 순서대로 나열할 수 있는 경우 Countable이라고 한다.
Uncountable set의 예시로는 Real number set이 존재한다.