PBL Report (개인성찰 노트)
2020년 도전학기 Midterm PBL Report (Action Learning)
Class: Basic Math for AI
(인공지능을 위한 기초수학)
Professor: Sang-Gu LEE
Due day: 2020/08/10 (Monday, 11:00 am)
Name:
Yuhai Oleksandr (유가이 올렉산드르)
Major:
Bio-Mechatronic Engineering
Student Number: 2018
(1) State more than 10 Math Definitions and concepts what
you learned in Part 0, 1 and 2.
|
Part 0 (인공지능 개론) |
Briefly reviewed the basic functions of Python,
Sage and R, Basic concept of Power Method(거듭제곱법), Basic concept of MNIST 데이터셋을 활용한 손 글씨 숫자 인식(패턴인식), Briefly
familiarized myself with the principle of work of AlphaGo… |
|
Part 1 (인공지능 행렬과 데이터분석) |
벡터, 내적, 벡터의 노름, 코시-슈바르치 부등식, 정사영(projection), 선형연립방정식(system of linear equations), 첨가행렬(augmented
matrix), 기본행 연산(ERO), 행 사다리꼴(REF), Row
Reduced Echelon Form, Gauss 소거법과 Gauss-Jordan 소거법, 행렬과 행렬식, vector sum,
scalar multiplication, 행렬의 곱(product), 영행렬(zero matrix), trace, 역행렬, 가역행렬의 성질, 대각행렬, 스칼라행렬, 대칭행렬, 치환(permutation), 수반행렬(adjugate, adjunct), 일차독립, 일차종속, Subspace, 기저, 차원, nullity, column space and row space, 계수(rank), Rank-Nullity
정리, 최소재곱해(least square solution), Normal equation, Orthonormal basis,
Gram-Schmidt 정규직교화 과정, QR 분해, 선형변환(Linear Transformation), 표준행렬, 핵(kernel)과 치역(range), 동형사상(isomorphism), 고윳값, 고유벡터, 대각화(Diagonalization), 닮음 행렬(similar matrix), 직교대각화(orthogonally diagonalizing), 고윳값분해(eigen-decomposition), SVD(특이값 분해), 일반화된 역행렬(Pseudo-inverse, Moore-Penrose Generalized Inverse), 이차형식(quadratic
form), 주축정리(Principal axis theorem)… |
|
Part 2 (다변수 미적분학과 최적화) |
함수, 극한(limit), 도함수(derivative)와 미분(differentiation), 뉴턴 방법(Newton’s Method
with gradient), 적분(Integral), 리만 합(Riemann sum), 외적(Cross Product), 벡터 함수, 편도함수(Partial Derivative)와 그래디언트(gradient), 연쇄법칙(Chain
Rule), 방향도함수(directional
derivative), Hessian, Taylor 정리, 함수의 극대(Local Maximum) and 극소(Local Minimum), Fermat’s theorem on critical
points, 임계점(critical point), 안정점(saddle point), Gradient
Descent Algorithm(경사-기울기 하강법), 중적분(double
integral, multiple integral), Fubini의 정리, Polar
Coordinates에서의 2중적분, Jacobian…
|
Part 0 (인공지능 개론)
1.
Python is an interpreted,
high-level, general-purpose programming language. Python has become highly
popular due to its abundance of libraries. Each Python library is
application-oriented that was developed to address problems. Mathematical
operations are most preferably carried out in Python due to its focus on
utility and minimal programming jargon. There are several libraries that can be
used to carry out mathematical operations with Python. Ex.: Math,
Numpy, SciPy, Scikit-learn etc.
2.
SageMath is a free open-source
mathematics software system licensed under the GPL. It builds on top of many
existing open-source packages: NumPy, SciPy, matplotlib, Sympy, Maxima, GAP,
FLINT, R and many more. Access their combined power through a common, Python-based
language or directly via interfaces or wrappers.
3.
R is a programming language for
statistical data processing and graphics, and is a free and open source
computing environment under the GNU Project.
4.
Power method is an eigenvalue
algorithm: given a diagonalizable matrix A, the algorithm will produce a number
λ, which is the greatest (in absolute value) eigenvalue of A, and a nonzero
vector v, which is a corresponding eigenvector of λ, that is Av = λv.
5.
MNIST(Modified National Institute
of Standards and Technology) database is a voluminous database of handwritten
numbers. The database is a standard proposed by the US National Institute of
Standards and Technology for the purpose of calibrating and comparing image
recognition methods using machine learning primarily based on neural networks.
6. AlphaGo
is a "Go game" program developed by Google DeepMind in 2015. AlphaGo
combines a technique that provided a major breakthrough in the power of
"Go game" software in 2007-2012 (Monte-Carlo tree search) and
recent advances in machine learning, namely deep learning with multilevel
neural networks.
Part 1 (인공지능 행렬과 데이터분석)
1.
Vector is an object that has both
a magnitude and a direction. Geometrically, we can picture a
vector as a directed line segment, whose length is the magnitude of the vector
and with an arrow indicating the direction. The direction of the vector is from
its tail to its head.

2.
Vector projection of a vector a
on (or onto) a nonzero vector b is the orthogonal projection of a
onto a straight line parallel to b. It is a vector parallel to b,
defined as: a1 = a1
, where a1 is a scalar,
called the scalar projection of a onto b, and
is the
unit vector in the direction of b. Note that, scalar projection
is defined as:
a1 = ||a|| cos θ = a ·
= a · ![]()
where · denotes a dot product,
||a|| is the length of a, and θ is
the angle between a and b.

Note that, both the projection
a1 and rejection a2 of a
vector a are vectors, and their sum is equal to a,
which implies that the rejection is given by: a2 = a – a1.
3.
기본행연산: 기본행연산법에는 3개의 방법이 있다.
·
두 행을 교환 (Ri ó Rj).
·
한 행에 0이 아닌 상수를 곱함 (kRi ó Ri, where k ≠ 0).
·
한 행의 배수를 다른 행에 더함 (Ri + kRj
=> Ri, where i ≠ j).
4.
Gauss
소거법: 선형연립방정식의 첨가행렬을 REF로 변형하여 푸는 방법이다.
5.
Gauss-Jordan
소거법: 선형연립방정식의 첨가행렬을 RREF로 변형하여 푸는 방법이다.
6.
행렬의 곱셈(세종대왕의 기역 법칙):
두 행렬 A = [aij]mxp,
B = [bij]pxn에 대하여 A와 B의 곱(product)
AB를 다음과 같이 정의한다.
AB = [cij]mxn
여기서,
cij = ai1b1j + ai2b2j
+ ··· + aipbpj =
(1 ≤ i ≤
m, 1 ≤ j ≤ n)


7.
가역 행렬(invertible
matrix)은 그와 곱한 결과가 단위 행렬인 행렬을 갖는 행렬이다. 이를 그 행렬의 역행렬(inverse matrix)이라고 한다.
8.
대칭 행렬(symmetric
matrix)은 전치 행렬(transposed matrix)이 스스로와 같은 행렬이다 (A = AT).
9.
치환행렬(permutation matrix) 은 순서가 부여된 임의의 행렬을 의도된 다른 순서로 뒤섞는 연산 행렬이다.
일반적으로 치환행렬은 단위행렬로부터 얻을수있는 이진 행렬이다. 반대각행렬은 치환행렬의 특수한 경우이다.
10. 계수-퇴화차수 정리(rank-nullity
theorem)는 행렬의 상과 핵의 차원의 관계에 대한 정리이다.
11. QR 분해(QR
decomposition)는 실수 행렬을 직교 행렬과 상삼각 행렬의 곱으로 나타내는 행렬 분해이다. 그람-슈미트 과정이나 하우스홀더 행렬이나 기븐스 회전을 통해 얻을 수 있으며, 선형 최소 제곱법이나 QR 알고리즘에서 쓰인다.
12. 고유벡터(eigenvector)는 그 선형 변환이 일어난 후에도 방향이 변하지 않는,
영벡터가 아닌 벡터이다.
13. 고윳값(eigenvalue)는 고유벡터의 길이가 변하는 배수를 선형 변환의 그 고유 벡터에 대응하는 값이다.
14. 대각화 가능 행렬(diagonalizable
matrix)은 적절한 가역 행렬로의 켤레를 취하여 대각 행렬로 만들 수 있는 정사각 행렬이다.
15. 고유값 분해(eigen
decomposition)는 고유값 과 고유벡터로 부터 유도되는 고유값 행렬과 고유벡터 행렬에 의해 분해될수있는 행렬의 표현이다.
16. 특이값 분해(Singular
Value Decomposition)는 행렬을 특정한 구조로 분해하는 방식으로, 신호 처리와 통계학 등의 분야 에서 자주 사용된다.
17. Quadratic
form is a function on a vector space, specified by a homogeneous polynomial
of the second degree in the coordinates of the vector.
18. Principal
axis is a certain line in a Euclidean space associated with an ellipsoid or
hyperboloid, generalizing the major and minor axes of an ellipse or hyperbola.
The principal axis theorem states that the principal axes are
perpendicular, and gives a constructive procedure for finding them.
Part 2 (다변수 미적분학과 최적화)
1.
Function(함수) is a binary relation over two sets that associates
to every element of the first set exactly one element of the second set.
2.
Riemann sum is a certain kind of
approximation of an integral by a finite sum. One very common application is
approximating the area of functions or lines on a graph, but also the length of
curves and other approximations.
3.
Partial derivative of a function
of several variables is its derivative with respect to one of those variables,
with the others held constant.
4.
기울기(gradient)란 벡터 미적분학에서 스칼라장의 최대의 증가율을 나타내는 벡터장을 뜻한다. 기울기를 나타내는 벡터장을 화살표로 표시할 때 화살표의 방향은 증가율이 최대가 되는 방향이며, 화살표의 크기는 증가율이 최대일 때의 증가율의 크기를 나타낸다.
5.
Fermat's theorem is a method to
find local maxima and minima of differentiable functions on open sets by
showing that every local extremum of the function is a stationary point (the
function derivative is zero at that point).
6.
경사 하강법(Gradient
descent)은 1차 근삿값 발견용 최적화 알고리즘이다. 기본 개념은 함수의 기울기(경사)를 구하여 기울기가 낮은 쪽으로 계속 이동시켜서 극값에 이를 때까지 반복시키는 것이다.
7.
Multiple integral is a definite
integral of a function of more than one real variable, for instance, f(x,
y) or f(x, y, z).
8. 야코비 행렬(
Jacobian matrix)은 다변수 벡터 함수의 도함수 행렬이다.
(2) State more than 5 things that you know/can/find
after you studied the first Part 1 and 2. (Please, note that, I will only indicate the most
important terms(in my opinion) that I remember the most.)
1. After
completing part 1, I can freely find the Inverse of the matrix.
Below I will give in my
opinion the fastest and simplest method for finding the inverse of a matrix. A method for
finding the inverse of a matrix using Linear Row Reduction.
Step1: Adjoint the identity matrix to the original matrix.
Step2:
Perform linear row reduction operations.
Step3:
Continue until you form the identity matrix (on the left side of the newly
augmented matrix).
Step 4:
Write out the inverse matrix.
In Sage,
let's say we have a square matrix A, to find its inverse we can use the
command: A.inverse ().
2. Also,
I can freely use Gram-Schmidt Process for ortho-normalizing a set of
vectors in an inner product space. Imagine that we are given a basis {x1,
x2, … ,xp} for a nonzero subspace W
or Rn, so, we can define that,
v1 = x1
v2 = x2 - ![]()
v3 = x3 -
- ![]()
⋮
vp = xp -
-
- ··· - ![]()
Then {v1,
… ,vp} is an orthogonal basis for W. In addition,
note that,
Span {v1, … ,vk} =
Span{x1, … ,xk} for 1 ≤ k ≤ p
In Sage,
we can easily applicate Gram-Schmidt process using the command
(In the case of matrix A):
A.gram_schmidt().
3. I
consider Singular Value Decomposition(SVD) to be one of the key topics
of linear algebra, thanks to the professor and other students, I understood
this topic more deeply. Let's go over the basic steps for SVD (Again, let's
call our matrix A):
Step1:
Compute transpose of our matrix, AT, and also compute ATA.
Step2:
Determine the eigenvalues of ATA and sort these in
descending order, in the absolute sense. Then, square roots these to obtain the
singular values of A.
Step3:
Construct diagonal matrix Σ by placing singular values in descending
order along its diagonal. Then, compute its inverse, Σ-1.
Step4:
Use the order eigenvalues from step 2 and compute the eigenvectors of ATA.
Place these eigenvectors along the columns of V and compute its
transpose, VT.
Step5:
Compute U as U = AVΣ-1. To compute the
proof, compute the full SVD using A = UΣVT.
In Sage,
use the following code to calculate the SVD (an example is given for a 2x2
matrix, but you can use it for larger matrices, just slightly correcting the
code in some places):
A = matrix([Given Matrix A])
B = A.transpose()*A
eig = B.eigenvalues()
sv = [sqrt(i) for i in eig] #특이값 구하기
print(B.eigenvectors_right()) #(A^T)(A)의 고유벡터 구하기, A의 right singular vectors
G = matrix([Matrix formed by Eigenvectors])
Vh = matrix([1/G.row(j).norm()*G.row(j) for j in
range(0,2)]) #V의 전치행렬; Note: change range value based on matrix size
Vh = Vh.simplify() #V의 전치행렬 표현
print(Vh)
U = matrix([A*Vh.row(j)/sv[j] for j in
range(0,2)]).transpose()
print(U) # U의 열들을 A의 left singular vectors
S = diagonal_matrix(sv)
print(S)
print(U*S*Vh)
4. I
also fully understand and can use Newton's Method in optimization.
Suppose you need to find the root of a continuous, differentiable function f(x),
and you know the root you are looking for is near the point x = x0.
Then Newton’s method tell us that a better approximation for the root is
x1 = x0 - ![]()
Repeat
this process as many times as necessary to get desired accuracy. In general,
for any x-value xn, the next value is
given by
xn+1 = xn – ![]()
In Sage, you can use Newton's Method as follows:
#Use a loop
to compute iterations of Newton-Raphson's Method
x = var('x')
f(x) = Given
function
fp =
diff(f,x)
NewtonIteration(x)
= x - (f/fp)(x)
xn = Initial
guess;
print('x0 =',
xn);
for i in
range(10): #Number of interations
xn =
N(NewtonIteration(xn),digits=10);
print('x', i+1, '=', xn);
print("This
is the exact answer for comparison: ")
print(solve(f(x)==0,
x))
5. After studying part two, I fully understood the topic
of multiple integrals. In particular, I understood well the meaning of Fubini's
Theorem. Fubini's Theorem is a result that gives conditions under which it
is possible to compute a double integral by using an iterated integral. One may
switch the order of integration if the double integral yields a finite answer
when the integrand is replaced by its absolute value.

As a
consequence, it allows the order of integration to be changed in certain
iterated integrals. Fubini's theorem implies that two iterated integrals are
equal to the corresponding double integral across its integrands.
In Sage,
you can calculate multiple integrals using the following code (I will give an
example code for calculating a double integral, but it can also be used for a
triple integral or more):
f(x, y) = Given function
#in this example, I’ll integrate in the order dy dx
f(x, y).integrate(y, lower limit, upper
limit).inegrate(x, lower limit, upper limit)
6. One
of the most important topics in Part 2 is Gradient Descent
Algorithm. Following are the main steps for using
Gradient-Descent Algorithm.
Step1: Sets the initial
guess and precision of the calculation
, ε.
Step2:
Then, calculate
=
– λ[j] ∇F(
), where λ[j]
= argminλF(
- λ[j] ∇F(
))
Step3:
Finally, check the stop condition:
·
If,
|
-
|> ε; |F(
) – F(
)| > ε; or ||∇F(
)|| > ε (choose one of the conditions), then j = j + 1
and we need to go to step 2
again.
· Otherwise,
=
and stop.
Example Sage code from the textbook for Gradient-Descent Algorithm
problem:
# initializing
A = diagonal_matrix(RR, [20, 10, 2, 1])
b = vector(RR, [1, 1, 1, 1]) # objective function
x0 = vector(RR, [0, 0, 0, 0]) # initial guess
g0 = -b # initial gradient
r = [] # 그래프를 그리기 위한 용도
# main iteration
for i in range(0, 200):
gn = g0.norm()
r.append((i, gn))
if gn < 10^(-8):
print("Stationary point! Algorithm terminated!")
break
w = A*g0
a = g0.inner_product(g0)/(g0.inner_product(w)) # step-size
x1 = x0-a*g0
g1 = A*x1-b
x0 = x1;
g0 = g1
show(line2d(r) + point(r, color = 'red')) # gradient 의 norm을 그래프로 그림
References:
[1] 이상구, 이재화., (2019), “인공지능을 위한 기초수학”, BigBook, Part 0,
Part I and Part II
[2] David
C. Lay, Steven R. Lay, Judi J. McDonald., (2016),“Linear Algebra and its
applications”, Pearson, pp. 63~78
[3]
James Stewart., (2016), “Calculus – Early Transcendentals”, Cengage Learning,
pp. 10~270, 276~291; 345~348;
[4] Wikipedia.,
(2020), “Definition of some concepts from Parts 0, 1 and 2 above”, Wikimedia
Foundation
· All the above pictures were used in accordance with the CC (Creative Commons) license.
This means that I can freely use, share
and adapt the content.
(3) State your
meaningful Comment/Answer/Discussions in Discussion/QnA. (Note: I will cite
just a few of my responses, comments that I find really meaningful and
helpful.)
1. Final by 천가영, 유가이 and SGLee [HW] 벡터에 관한 질문 by 천가영 <- 답변 by 유가이
1. 벡터는 크기와 방향을 갖는 유향선분 - 2차원, 3차원 공간의 벡터는 화살표로 표현 가능
-> Q1. 차원 벡터도 존재하나요?
답:
존재합니다.
만약 존재한다면
1차원 벡터는 화살표로 표현 불가능한가요?
답:
화살표로 표현하지 못하는 벡터들도 존재합니다)
아니면
1차원은 공간으로 간주되지 않아서 그런 것인가요?
답:
아닙니다.
1차원 벡터 공간도 존재합니다.
2.
(R^n 안의)
벡터
X의 노름은 원점에서 점
P(x1, x2, ... , xn)에 이르는 거리로 정의됨을 의미한다.
->Q2 아래의 그림과 같이 시점이 원점이 아닌 벡터는 두 벡터의 합으로 밖에 표현할 수 없나요?

답: 아닙니다. 시점이 원점이 아닌 벡터는 원점으로 옮겨놓고 norm 노름을 구하시면 됩니다)
Remark by 유가이 올렉산드르:
in answering this question, I tried to explain the concept of a vector in as much detail as possible. I also explained the concept of a
vector in different spaces and gave several examples for a deeper
understanding. Also thanks to the Professor's help (additional
material and correction of minor inaccuracies), I hope that this answer cleared
up all the student's doubts about the vector in space.
2. [Final OK by SGLee] Finalized by 한수현, 유가이 올렉산드르, 박지수] [HW-해공간을 구하는 법, Kernel(Null Space), Right Null Space, Left Null
Space
Remark by 유가이 올렉산드르: Adding an
additional answer and finalizing this post, I decided to tell more about
Kernel(Null Space). I also explained the difference between right kernel and
left kernel and used python for visualization. In the end I showed a slight
difference when calculating null space in saga and python (using sympy library).
3. [Final OK by TA] [Final] Q by 김진웅 A by 유가이올렉산드르, 이상구 F by 김진웅 [HW 질문] 서로 같은 고유값에 대응하는 고유벡터들 차원 (JCF)
어떤 행렬 A 와 B 가 주어졌을 때 ...
서로 같은 (중근의) 고유값에 대응하는 (일차독립인)
고유벡터들이 이루는
부분공간 (eigenspace) 의 차원이 다를 때가 있는데 ...
어떻게 구분하여 알 수 있나요?
A 의
닮은 대각선행렬
: ![]()
B 의
닮은 대각선행렬 :
라는 의미는?
무엇인가요?
Here is my answer:
유가이올렉산드르(2018****33)7월 21일 오전 2:58
Let's
try to analyze the given example.
The first matrix "D = ([[1, 0], [0,
1]])" has two eigenvalues (1 and 1) but they are obviously not distinct.
Since A is the identity matrix, Av=v for any vector v, i.e. any vector is an
eigenvector of A. We can thus find two linearly independent eigenvectors (say
<-2,1> and <3,-2>) one for each eigenvalue.
But,
the second matrix "D = ([[1, 0], [1, 1]])" also has non-distinct
eigenvalues of 1 and 1. All eigenvalues are solutions of (A-I)v=0 and are thus
of the form <t,0>. Hence, in this case there do not exist two linearly
independent eigenvectors for the two eigenvalues 1 and 1 since <t,0> and
<s,0> are not linearly independent for any values of s and t.
Remark
1: Every eigenvalue with multiplicity = n will be associated with n different
(as in linearly independent) eigenvalues.
Multiplicity
is how many "times" it shows up as an eigenvalue. It is like when you
find only one solution to a second degree equation, which always has two roots.
This solution has a multiplicity = 2.
Remark
2: If a matrix has more than one eigenvector the associated eigenvalues can be
different for the different eigenvectors.
Geometrically,
the action of a matrix on one of its eigenvectors causes the vector to stretch
(or shrink) and/or reverse direction.
4. [Final OK by SGLee] Finalized by 나종진,
답변 by 유가이올렉산드르
, 직교대각화가능할 필요충분조건(교재 p.125) 질문 by 나종진
Remark by 유가이 올렉산드르:
The student had minor problems with Sage code for Orthogonal Diagonalization, so I slightly corrected the code here.
My answer:
유가이올렉산드르(2018****33)7월 23일 오후 7:55
12번째 라인에서 C.row(i) => C.column(i)로 수정하시면 될 것 같습니다.
A=matrix([[0,3,3], [3,0,3], [3,3,0]])
print(A.eigenvectors_right())
print
x1=vector([1,0,-1])
x2=vector([0,1,-1])
x3=vector([1,1,1])
B=matrix([x1, x2])
[G, mu] = B.gram_schmidt()
print(G)
print y1=vector([1,0,-1])
y2=vector([-1/2, 1, -1/2])
C = column_matrix([y1,y2,x3])
P = column_matrix([C.column(i) /
C.column(i).norm() for i in range(0, 3)])
print("P =")
print(P)
print
print(P.transpose()*A*P)
유가이올렉산드르(2018****33)7월 23일 오후 8:26
코드를 실행해봤는데 예제의 답과 같은 답이 나옵니다.
5. 답 by 유가이 올렉산드르, 이상구 교수님, 질문 by 한수현, Newton's Method에 대한 질문
두 설명(with and without gradient) 모두 Newton's method라고 하는 것을 보면, 각각이 결국 같은 방식을 이용하여 원하는 근사값을 구한다는 의미로 보입니다. 하지만 저는 저 두 내용이 완전히 관련 없는 독립된 내용으로 느껴집니다. 그래서 저 두 내용의 상관관계를 설명해주시면 좋겠습니다.
유가이올렉산드르(2018****33)8월 9일 오전 5:21
I think in both cases we are talking about the
same iterative method (Newton's method). The difference is played by the
dimension in which we work. As you know, in calculus, Newton's method is an
iterative method for finding the roots of a differentiable function f, which
are solutions to the equation f(x) = 0. In optimization, Newton's method is
applied to the derivative f′ of a twice-differentiable function f to find the
roots of the derivative (solutions to f′(x) = 0), also known as the stationary
points of f. These solutions may be minima, maxima, or saddle points. In
relatively Low dimensions we use classical Newton's method, but in Higher
Dimensions we can also use Newton's method, all we need to do is replace the
derivative with a gradient. also, please note that the geometric meaning in
both cases remains the same. Also often Newton's method(with gradient) is modified
to include a small step size 0 < gamma <= 1 instead of gamma = 1(pay
attention to the classic formula, there the gamma is 1). Below I tried (taking
into account the possibilities of the comments section) to give the basic
formula that the Newtonian method represents (with and without a gradient).
x_{k+1} = x_{k} - f'(x_{k}) / f''(x_{k}) and x_{k+1} = x_{k} -
gamma[f''(x_{k})] / f'(x_{k}) The method is the same, just the area of
application is slightly different. Newton's method with gradient is often done
to ensure that the Wolfe conditions are satisfied at each step of the method.
For step sizes other than 1, the method is often referred to as the relaxed or
damped Newton's method. The geometric interpretation of Newton's method is that
at each iteration, it amounts to the fitting of a paraboloid to the surface of
f(x) at the trial value x_ {k}, having the same slopes and curvature as the
surface at that point, and then proceeding to the maximum or minimum of that
paraboloid (in higher dimensions, this may also be a saddle point). The central
problem of optimization is minimization of functions, and Newton's Method copes
with it relatively quickly. Hope this was helpful. Please correct me if I was
wrong somewhere. [Reference: Read more on https://en.wikipedia.org/wiki/Newton%27s_method_in_optimization]
이상구(LEE SANGGU)8월 9일 오전 6:57
Good. 같은 뉴턴 알고리즘 입니다. 차원만 인공지능 에서 사용하는 고차원으로 일반화 한것입니다.
(4) Below, I have consistently indicated
all my QnA activity.
[1.1] [1st HW] 간단한 자기소개와 수강동기, 유가이올렉산드르
[1.2] [Final OK by SGLee] [수정본] 추가답변 및 Re-finalized by 유가이 올렉산드르, Finalized by 김범준 [1주차HW-질문] 일차독립
[1.3] [Final OK by TA] Final [HW (1주차 배운 내용 요약 1] 나종진 + 유가이 : 다항함수의 개형을 그리기 + [HW] 질문 Q4. 교재 p.110(PDF p.118)와 답 by 유가이올렉산드르, 나종진, 이상구교수님
[1.4] [Final OK by TA and SGLee] Final by 천가영, 유가이 and SGLee [HW] 벡터에 관한 질문 by 천가영 <- 답변 by 유가이
[1.5] Finalized by 유가이 올렉산드르 2-1강에 대해 질문 by 이상현, 답변 by 이상구 교수님
[1.6] [Final OK by SGLee] Finalized by 한수현, 유가이 올렉산드르, 박지수] [HW-해공간을 구하는 법, f Kernel(Null Space), Right Null Space, Left Null
Space
[1.7] [Final OK by TA] [Final] Q by 김진웅 A by 유가이올렉산드르, 이상구 F by 김진웅 [HW 질문] 서로 같은 고유값에 대응하는 고유벡터들 차원 (JCF)
[1.8] [Final OK by TA] [HW] 열공간, 해공간, 영공간 사이의 관계, 질문 by 김진웅, 답변 by 장환승, 추가답변 및 Finalized by 유가이 올렉산드르
[1.9] [Final OK by SGLee] [HW] 1주차 강의 내용 요약 및 정리 + Sage과 Python 실습(비교), 내용 요약 및 정리 by 박진형, 코딩실습 및 Finalized by 유가이 올렉산드르
[2.1] [HW2] 선형변환 (Linear Transformation) 강의 요약 및 정리 + 연습문제 풀기
[2.2] [Final OK by SGLee] Finalized by 나종진, 답변 by 유가이올렉산드르 , 직교대각화가능할 필요충분조건(교재 p.125) 질문 by 나종진
[2.3] [HW2] 고윳값(eigenvalue), 고유벡터(eigenvector), 대각화(Diagonalization) 강의 요약 및 정리 + 연습문제 풀기
[2.4] [Final ok by SGLee] [HW2] 특이값 분해(Singular Value Decomposition, SVD) 강의 요약 및 정리 + 연습문제 풀기
[2.5] [Final OK by TA] 1주차 강의 내용 요약 및 정리 박진형, 코딩실습 및 Finalized by 유가이 올렉산드르
[3.1] [HW3] 함수(function), 극한(limit), 도함수(derivative)와 미분(differentiation) 강의 요약 및 정리 + 연습문제 풀기 + 코딩 실습
[3.2] [HW3] 미분의 응용 (Applications), 뉴턴-랩슨법 강의 요약 및 정리 + 근사 찾기 방법 비교 + 연습문제 풀기 + 코딩 실습
[3.3] [HW3] 적분 (Integral) 강의 요약 및 정리 + 연습문제 풀기 + 코딩 실습
[3.4] [Final OK by SGLee] [HW3] Finalized by 유가이 올렉산드르, 답변 by 이상구 교수님, Solved by 이상현 - 뉴턴 방법 증명
[4.1] [Final OK by SGLee] [HW 4] 연습문제 풀기 및 Re-Finalized by 유가이 올렉산드르, AI 을 위한 기초수학 16강 <미분적분학> [Gradient descent Algorithm] 개념 복습 및 정리 by 손원식, 추가 comment by 임성규, 이상구 교수님, 천가영
[4.2] Newton's Method에 대한 질문, 질문 by 한수현, 답 by 유가이 올렉산드르, 이상구 교수님
[4.3] Final OK by SGLee. [HW 4] 연습문제 풀기 및 Re-Finalized by 유가이 올렉산드르, Finalized by 손원식, AI 을 위한 기초수학 17강 <미분적분학> [중적분 (double integral, multiple integral)] 개념 복습 및 정리
[4.4] 경사하강법 실습(Newton's Method), 질문 by 한수현, 답 by 유가이 올렉산드르, 이상구 교수님, 김정한, 박진형
Ch. 2: Participation Part (참여부분, 정량) 자기 평가와 본인의 Project (Term paper) 제안서 등에 대해 아래를 채우시오. (20점)
Fill
in the below for your self-assessment and your project/term paper. (20 points/100)
A. (Quantity 10pts)
Briefly describe your contributions through Q&A for yourself and fellow
students in our "DM" classes!
(1) Quantity: Check your participation numbers in
Q&A <Refer your name in Q&A directly>: Each
week (Saturday to Friday)
▪ Week
1: 9
Week 2: 5
Week 3: 4 Week 4: 4 (Total = entries) 22
Total number of sessions
(Q: 7 , A: 15 )
■ Number
of online attendances: ( 23 ) / 23 (1-4 week)
Online WebEx OH attendance:
( 3 ) / 3 (1-4 week)
Absences: 0
(2) 다음 밑줄 친 곳에 들어갈 내용을 고르시오.
나는 벡터, 내적, 벡터의 노름, 코시-슈바르치 부등식, 정사영(projection), 선형연립방정식(system of linear
equations), 첨가행렬(augmented matrix), 기본행 연산(ERO), 행 사다리꼴(REF), Row Reduced
Echelon Form, Gauss 소거법과 Gauss-Jordan 소거법, 행렬과 행렬식, vector sum,
scalar multiplication, 행렬의 곱(product), 영행렬(zero matrix), 역행렬, 대각행렬, 스칼라행렬, 대칭행렬, 치환(permutation), 수반행렬(adjugate,
adjunct), 일차독립, 일차종속, Subspace, 기저, 차원, nullity, column
space and row space, 계수(rank), Rank-Nullity 정리, 최소재곱해(least square
solution), Orthonormal basis, Gram-Schmidt 정규직교화 과정, QR 분해, 선형변환(Linear
Transformation), 표준행렬, 핵(kernel)과 치역(range), 동형사상(isomorphism), 고윳값, 고유벡터, 대각화(Diagonalization),
닮음 행렬(similar matrix), 직교대각화(orthogonally
diagonalizing), 고윳값분해(eigen-decomposition), SVD(특이값 분해), 일반화된 역행렬(Pseudo-inverse,
Moore-Penrose Generalized Inverse), 이차형식(quadratic form), 주축정리(Principal axis
theorem), 함수, 극한(limit), 도함수(derivative)와 미분(differentiation),
뉴턴 방법(Newton’s Method with
gradient), 적분(Integral), 리만 합(Riemann sum), 외적(Cross Product), 벡터 함수, 편도함수(Partial
Derivative)와 그래디언트(gradient), Jacobian, 연쇄법칙(Chain Rule), 방향도함수(directional
derivative), Taylor 정리, 함수의 극대(Local Maximum)
and 극소(Local Minimum), Fermat’s theorem on
critical points, 임계점(critical point), 안정점(saddle point),
Gradient Descent Algorithm(경사-기울기 하강법), 중적분(double integral,
multiple integral), Fubini의 정리의 개념을 이해하고 설명할 수 있으며 간단한 것은 손으로, 복잡한 것은 sage 또는 python 을 이용하여 계산하여 그 의미를 설명할 수 있다.
(3) 개인/동료와 같이 “본” 강좌를 학습하면서 배우거나 느낀 점은?
I am very glad that I had the opportunity
to once again get into this wonderful environment of the PBL class. I really
wanted to deepen my mathematical knowledge in the field of Artificial
Intelligence, and this summer semester, thanks to this subject (basic
mathematics for artificial intelligence), I have this opportunity. As I said
earlier, I really like the PBL technique, because thanks to it, each student
can actively participate in the educational process.
(4) What you contributed through this course (Q &
A and/or In-class):
I tried to actively participate every
week in the QnA. Most of my QnA activity consists of answering questions,
coding, finalizing and summarizing lecture materials. In almost every post I
have tried to attach examples of solving problems by hand and using Sage or
Python(or both) code, as I believe that a visual step-by-step process of
solving problems in practice can greatly help me and other students in
understanding the topic.
(5) (5 pt) What is your most
important contribution or founding that you shared with others in QnA.(Quality)
To my mind, my most important contribution that I
shared with others was:
[Final OK by SGLee] [HW] 1주차 강의 내용 요약 및 정리 + Sage과 Python 실습(비교), 내용 요약 및 정리 by 박진형, 코딩실습 및 Finalized by 유가이 올렉산드르
Here Mr. 박진형 summarized all the material for the first week, and I
added Python and Sage code for deeper understanding the material. Also, my goal
was to compare the capabilities of Python and Sage in solving mathematical
problems. From this coding practice, we can conclude that it is much more
convenient and faster to apply Sage in a mathematical environment.
(6)
Number of Final OK by SG Lee Problems (and/or Completed Discussion/Question) in
Q&A that your name is included:
13
B. (Quantity 10pts) Quality of
Your Participation:
(1) Write what you especially remember while you are
doing A-1, 2, 3.
I am very pleased that most of the
students in this class are very actively involved in the educational process.
Everyone is trying to share their knowledge in QnA, ask questions on an
incomprehensible topic, or help another student with a detailed answer. I also
try to be a part of this process and to participate as much as possible in the
QnA.
(2)
What did you learn or feel while learning Math for AI (Action Learning/PBL)
with your classmates?
I have greatly improved my mathematics
knowledge and also deepened my knowledge of programming. Thanks to the active
work of the Professor, TA and students, I significantly deepened my knowledge
of SVD, Newton's Method and Gradient Descent Method and learned a lot about the
way to apply them in practice.
Ch. 3: Personal
Reflection Note (20점)
|
Subject |
Basic Math for AI |
Major |
Bio-Mechatronic Engineering |
||||
|
Name |
Oleksandr Yuhai |
Year |
2018 2nd Semester |
||||
|
Learning contents |
Part0(Power Method, MNIST, AlphaGo). Part1(벡터, 선형연립방정식, 행렬과 행렬식, 일차독립과 기저(basis) 및 차원(Dimension), 선형변환
(Linear Transformations), 고윳값, 고유벡터, 대각화(Diagonalization), SVD (특이값 분해, singular value decomposition), 이차형식(quadratic form)). Part2(일변수함수와 미적분, 다변수함수와 미적분) |
||||||
|
Self-Checking |
|||||||
|
Activity |
Excellent |
Good |
Fair |
||||
|
1. |
I have contributed
to generate ideas and facts needed to resolve the issue. |
● |
|
|
|||
|
2. |
I proposed learning
issues associated with learning. |
|
● |
|
|||
|
3. |
When I study alone,
I used a variety of learning materials. |
● |
|
|
|||
|
4. |
I provide new
information and knowledge in this class. |
|
● |
|
|||
|
5. |
I was actively
involved in the discussions. And I provided a lot of questions in order to
understand these discussions. |
|
● |
|
|||
|
6. |
I have made a contribution
to the learning activities for our class. |
● |
|
|
|||
|
※ Please record the following items by considering your learning
process. 1. Do you understand the most of contents of this
learning process? I understood at a
sufficient level most of the topics from Part 0 to Part 2. I also learned
many new methods of how to solve mathematical problems using programming
languages (Sage, Python). 2. What kind of learning materials have you used to
study? In the
process of studying Mathematics for Artificial Intelligence, I most often
used our professor's textbook and video lectures. But I also actively used
various books such as Linear Algebra and its applications by David C. Lay,
Calculus - Early Transcendentals by James Stewart, and others. I also used
useful information from various math forums, thematic videos on YouTube, math
blogs. I believe that all this was made possible through the use of the PBL
learning system. Usually,
I first get acquainted with the topic in our textbook book(Basic Math for AI
by 이상구 교수님 with 이재화
TA님), then I watch the lecture of the professor, after
that I look for more information on topics that are not entirely clear to me
in other lectures of the professor (Linear Algebra, Calculus, etc.) on the
site http: // matrix.skku.ac.kr/sglee/, after that for a deeper understanding
of the material, I look for information in other books (Linear Algebra and
its applications by David C. Lay, Calculus - Early Transcendentals by James
Stewart, etc.). After that, I begin to search for more extensive information
on the topic on the Internet (usually material related to practice). Finally,
I start to practice solving tasks from textbooks manually and using Sage or
Python (or both). After that, I usually post all the information I have
collected in the QnA section and then start trying to answer questions from
other students in QnA. 3. What did you learn through the learning
activities of this course? Through learning activities I realized the
importance of solving math problems not only by hand, but also using
programming languages such as Sage and Python. I also understood the
importance of active participation of students in the educational process. I
believe that thanks to the active participation of students and Professor in
the QnA, many even rather complex mathematical topics have become much
clearer. Even though I have already taken courses on Linear Mathematics and
Discrete Mathematics, I learned a lot of new things for myself from other
students (for example, the scope of SVD). Also, since I did not take courses
in Calculus, I learned a lot about such very interesting and important topics
as partial differentiation, and the Gradient Descent Algorithm. 4. What have you learned from the other colleagues? 5. Self-Evaluation for Q/A Activities My score: 97 - Sometimes I
posted my posts to the I-Campus a little late, as they took me a lot of time
to write, but I tried to post at least 4 posts(summarizing the lecture
materials, answering questions, finalizing, programming etc.) every week. 6. Evaluation for other students Almost
all students in our class actively participated in the development of our Basic
Math for AI class. I think that, thanks to the PBL system, many students were
able to become a support for each other in understanding a variety of
difficult mathematical topics. And I also think that thanks to the active
participation of students, the professor, and TA in the learning process,
many students were able to master most of the material from the first two
parts at a fairly good level (even students from the Humanities and Social
Sciences Campus who may not be familiar with Linear Algebra or Calculus
before). |
|||||||
|
|
|
|
|
|
|
|
|
Self-Evaluation
|
Subject |
Basic
Math for AI |
Major |
Bio-Mechatronic
Engineering |
||||||
|
Name |
Oleksandr Yuhai |
|
|
||||||
|
Evaluation Items |
Strongly
disagree |
Disagree |
Mostly disagree |
Mostly agree |
Agree |
Strongly agree |
|||
|
|
1. I participated actively in both, online and offline classes. |
|
|
|
|
|
● |
||
|
|
2. I participated actively on a Q&A activity. |
|
|
|
|
● |
|
||
|
|
3. My question and replies made on Q&A are relevant. |
|
|
|
|
|
● |
||
|
|
4. Information provided by my activity was useful for other students in
the class. |
|
|
|
|
● |
|
||
|
|
5. I enthusiastically took into the consideration other students’
opinions or point of view. |
|
|
|
|
|
● |
||
|
|
6. I contributed to class by participating on Q&A discussions. |
|
|
|
|
● |
|
||
|
|
7. I am enthusiastic about taking other class with the same students I am
taking Basic Math for AI. |
|
|
|
|
|
● |
||
|
[Opinion] ► Satisfaction according to the Self-Evaluation I
think that I was quite active in QnA, summarizing up the lecture material,
practicing solving various problems manually and through the program code,
finalizing the solutions of other students and, if possible, answering
questions. Also, I think that, my work has helped other students to learn
something new in solving problems in Linear Algebra and Calculus. ► Sorrow according to the Self-Evaluation Sometimes
I posted my posts in the QnA section a little late (at the end of the week),
but I tried to make each of my posted posts as informative and useful as
possible. |
|||||||||
|
|
|
|
|
|
|
|
|
|
|
Peer-Evaluation
|
|
||||||||
|
Subject |
Basic Math for AI |
|||||||
|
Colleague’s
name |
김범준 |
|||||||
|
Name
of evaluator |
Oleksandr
Yuhai |
|||||||
|
Evaluation Items |
Strongly
disagree |
Disagree |
Mostly disagree |
Mostly agree |
Agree |
Strongly agree |
||
|
|
1. I participated actively in both, online and offline classes. |
|
|
|
|
|
● |
|
|
|
2. I participated actively on a Q&A activity. |
|
|
|
|
|
● |
|
|
|
3. My question and replies made on Q&A are relevant. |
|
|
|
|
● |
|
|
|
|
4. Information provided by my activity was useful for other students in
the class. |
|
|
|
|
● |
|
|
|
|
5. I enthusiastically took into the consideration other students’
opinions or point of view. |
|
|
|
|
● |
|
|
|
|
6. I contributed to class by participating on Q&A discussions. |
|
|
|
|
|
● |
|
|
|
7. I am enthusiastic about taking other class with the same students I am
taking Discrete Mathematics. |
|
|
|
|
● |
|
|
|
[Opinion] ► Satisfaction according to the Self-Evaluation A
student from the Faculty of Consumer Science, pretty quickly adapted to the
PBL system of this math related class and actively participated in QnA. I
also believe that during his studies he improved his mathematical and
programming (Sage) knowledge to a great extent. ► Sorrow according to the Self-Evaluation 없습니다. |
||||||||
|
|
|
|
|
|
|
|
|
|
Flipped/PBL Action Learning Class
|
Evaluation
Details |
Evaluation |
||||
|
Strongly
agree |
Agree |
Neutral |
Disagree |
Strongly disagree |
|
|
1. I
participated actively in Flipped/PBL classes. |
|
V |
|
|
|
|
2. Professor helped students to
demonstrate their abilities. |
V |
|
|
|
|
|
3. I
obtained new skills and knowledge due Flipped classes. |
V |
|
|
|
|
|
4. Through that process of learning I developed
my abilities of making hypothesis. |
|
V |
|
|
|
|
5. Through that process of learning I obtained or
developed leadership capabilities. |
|
V |
|
|
|
|
6. I learned multiple methods of solving
problems. |
V |
|
|
|
|
|
7. I am now able to use various materials needed
to study efficiently enough. |
V |
|
|
|
|
|
8. I developed my professionalism. |
V |
|
|
|
|
|
9. The process of learning I experienced is
similar to the real process of doing researches. |
V |
|
|
|
|
|
10. Evaluation of method of learning is relevant. |
V |
|
|
|
|
|
11. I gained more knowledge by problem solving. |
V |
|
|
|
|
|
12. I used and developed my communicative skills
through the process of learning. |
V |
|
|
|
|
|
13. The result of the study was obtained through
problem solving. |
|
V |
|
|
|
|
14. I think that the idea Flipped classes was
useful for me. |
V |
|
|
|
|
|
15. I am enthusiastic about learning method of
Flipped class. |
V |
|
|
|
|
* A more detailed description of
the 5, 12 and 14 points.
5-1. In process of
learning I was able to greatly improve not only my skills in math, but also my
communication skills.
12-1. Actively communicating with other students and our
professor and TA Professor in Q&A about various mathematical topics, I significantly improved my communication
skills.
14-1. I believe that
this flipped class method helped me to study the educational materials more
diligently, and thanks to the video lectures of the professor, and various
useful materials from the professor's website, I was able repeat our
educational material on Linear Algebra and Calculus whenever and wherever I
want. Also, this class helped me understand the importance of working in a team
and improved my communication skills.
16.
What is the merit of PBL system?
I believe that thanks to the PBL methodology, each
student has significantly improved their knowledge of mathematics and programming.
By their active participation in the educational process, students have become
a solid support for each other, which helps to quickly and relatively easily
master this rather voluminous subject.
17.
What can you suggest to improve this system of learning?
I would really
like our I-Campus to support mathematical operations (matrices, integrals,
etc.)
Open Feedback: Many thanks to the
professor and TA for maintaining the PBL methodology. I am very impressed with
how diligently the professor is participating in our educational process. I
think this gives me and the other students an incentive to study the material
more actively and participate in QnA.
Ch. 4: PBL
Participation Part (30점)
소개(1개); 요약, 정리, 문제 풀이 및 실습(6개); 답변 및
Finalization (16개)
[1st
HW] 간단한 자기소개와 수강동기, 유가이올렉산드르
안녕하십니까?
저는 이번도전학기에 인공지능을위한 기초수학 과목을 신청한 18학번
바이오메카트로닉스학과 유가이 올렉산드르입니다.
인공 지능은 현재 4차
산업 혁명에서 일어나는 중대한 변화에서 아주 중요한 역할을 하라고 생각힙니다. 저는
이전의 산업 혁명이 할 수 없었던 많은 변화를 사람들의 삶에 가져올 것이“인공
지능의 혁명”이라고
믿는다. 인공 지능을 통해 컴퓨터는 자신의 경험에서 배우고 주어진 매개 변수에 적응하고 이전에는 인간에게만 가능했던 작업을 수행 할 수 있습니다. 또한
지능형 지능의 가장 중요한 기능 중 하나는 거의 모든 분야에 적용될 수 있다는 것입니다. 제
경우에는 특히 신경망과 같은 인공 지능의 하위 영역에 관심이 많이 있습니다. 기계 학습 방법 (인공
신경망)을 사용하면 특히 의료공학 분야에서 더 많은 발전을 이룰 수 있다고 생각합니다. 예를 들어, 잘 작성된 알고리즘은 다양한 의료 기기의 센서에서 수신 된 방대한 양의 데이터를 분석 한 다음 논리적으로 가정(결론)을 할 수 있습니다. 또한
위에 언급과 같이 가장 간단한 인공 신경망을 만들더라도 기본적인 수학 지식 (알고리즘 등)이 필요하다는 점에 유의하고 싶습니다. 그리고
수학 분야의 지식을 넓히고 인공지능 분야(AI => Machine Learning => Neural Network)에서 이 지식을 적용하는 다양한 방법(Python,
Sage, R 사용함)을 배우기 위해 이 과목을 신청했습니다. 또한 PBL 시스템이
정말 마음에 들며, 이 덕분에 더 깊이 있고 종합적으로 과목을 공부할 수 있다고 생각합니다. 따라서
저는 이번 과목에는 좋은 결과를 얻기 위해 힘을 다할 것입니다.
저에게 어려운 점 중 하나는 한국어로 된 수학 용어(설명)가 많다는 것입니다. 그러나 저는 이 과정, 특히 PBL 시스템을
고려하여 과학 한국어(특히 AI 분야에서)도 향상시킬 수 있는 좋은 기회라고 생각합니다. 저는 QnA에서
활동하는 동안 약간 문법 오류가 있을 경우 양해주시면 감사하겠습니다 (때때로 저는 이해가 안되는 용어나 문장을 영어로 쓸 것입니다).
7주동안 잘 부탁드립니다.
감사합니다.
[Final
OK by SGLee] [수정본] 추가답변 및 Re-finalized by 유가이 올렉산드르, Finalized by 김범준 [1주차HW-질문] 일차독립
[1주차HW-질문] 일차독립
질문 by 김범준
답변 by 이상구 교수님
Finalized OK by 김범준 and SGLee
추가답변 및 Re-Finalized by 유가이 올렉산드르
1. 정사각행렬이 가역행렬이면 열들은 일차독립입니다. <--- OK
2. 그 이유는 가역행렬과 det(a)≠0은 서로 필요충분조건 관계에 있는데, 이는 행렬식을 이용한 일차독립 판정법 또한 det(a)≠0과 일차독립은 필요충분관계에 있기 때문입니다. <--- OK
3. 이와 마찬가지로 정사각 행렬이 비가역행렬이면 열들이 일차종속임 또한 알 수 있습니다. <--- OK
Q
1. 그렇다면, 일차독립을 구할때는 반드시 정 사각행렬을 만들어 구하는 방법을 써야 하는 건가요?
<--- Q1 에 대한 답. 일차독립 개념은 ... 아래 < 일차독립 정의>에서 보듯이,
정사각행렬의 열(column) 뿐 아니라 ... 벡터공간 안의 일반적인 벡터 들의 집합에 적용되는 개념 입니다.
http://matrix.skku.ac.kr/knou-knowls/CLA-Week-4.html

Q 2. 아니면 주어진 벡터들이 일차독립인지 아닌지 판별할 때, 정사각행렬을 만들지 않고도 판별하는 방법이 있나요?
<--- Q2 에 대한 답. 물론이지요, 일차독립의 정의 를 다시 읽어보시면 바로 이해 되실 것 입니다.
[정의대로 일차결합을 만들어 m by n 행렬 A 에 대하여, 동차 선형연립방정식 Ax = 0 의 해가 zero 벡터 뿐 임을 보이면 됩니다.]
Q 3. 추가질문
이제 벡터값이 주어지면 일차독립인지 여부를 확인하는데는 문제가없습니다. 하지만, 온라인교재를 찾아보아도 sage를 통해 A.ncols() ==
len(A.pivots())같이 행렬을 이용한 풀이방식밖에 찾지 못하였습니다. 1차원 벡터가 주어졌을때는 일차독립인지 종속인지 구별할 필요가 없는것인가요?
<----
Q3 에 대한 답. 일차독립의 정의를 보시면 이해할 내용인데,
일차독립 정의 2.
m by n 행렬 A에 대하여 Ax = 0 이 x=0 을 유일한 해로 갖는다면 A의 n개의 column
vector 들은 일차독립이다.
이 경우 직사각형행렬 A의 column
vector 들은 일차독립이다.
따라서 주어진 벡터들을 column
vector 들 로 하는 행렬 A 를 만들고,
Ax = 0 이 x=0 을 유일한 해로 갖는것을 보이면, column
vector 들이 일차독립 인것을 보이는 것이고, 영아닌 다른 해를 가지면 일차종속이 되는 것 입니다.
Comment : 모두 이해하였습니다^^ 감사합니다^^
Q1. 추가답변 및 예제:
아래 정리(Theorem)를 예로 봅시다. (편리성을 위해 정리 1라고 합시다.)
Characterization of
Linear Dependent Sets:
An indexed set, let’s call it S for
example, S = {v1, … , vp} of two or more vectors is linearly
dependent(일차종속) ó(if and only if) at least one of the
vectors in S is
a linear combination(선형조합) of the others. In fact, if S is
linearly dependent and v1 ≠ 0, then some vj (with j
> 1) is a linear combination of the preceding vectors(선행 벡터/이전 벡터), v1,
… ,vj-1.
주의: 1) 이 정리는 어떤 집합 안에 일차종속인 벡터가 존재한다고, 그 집합
안의 모든 벡터들이 다른 벡터들의 1차결합이라는 의미는 아닙니다. (일부는 일차독립일 수 있으며, 이 말은 그 집합 안의 어떤 (일차종속인) 벡터는 다른 벡터들의 일차결합으로 표현이 가능하다는 의미입니다.)
2) 어떤 집합 안에 일차종속인 벡터가 존재한다고 해도 , 일부는 일차독립일 수 있습니다.)
예제 (정사각행렬을 만들지 않고, 일차독립을 보이는 예의 풀이):
Problem Statement:
Let u = [3 1 0]T and v = [1 6 0]T (더 나은 시각화를 위해 전치행렬 (Transpose)을 사용함).
평행이 아닌 두 벡터 u와 v 가 span 하는 집합 span {u, v} 을 설명하고
{u, v, w}가 일차종속 집합인 경우에, 벡터 w가 스팬 span {u, v}에 있는 이유를 설명하십시오.
Solution
ð 따라서 w는 스팬 {u, v} 안에 있습니다. 아래 그림 참조하십시오.

이것은 위에서 해집합(솔루션)의 대략적인 시각화입니다. 이 덕분에 1차 종속 벡터와 1차 독립 벡터의 차이점에 대한 설명이 더 명확해지기를 바랍니다.
► 위 예제는 1차 (일차) 독립적인 u 및 v를 사용하여 R3에 모든 집합 {u,
v, w}을 일반화합니다.
► 세트 {u, v, w}는 w가 u와 v에 의해 스팬 된 평면에 있는 경우에만(if and
only if ó) 1차
종속입니다.
·
Q2. 추가답변 및 예제 (정사각행렬을 만들지 않고도 판별하는 방법)
·
또 하나의 정리(Theorem)를 예로 봅시다.
(편리성을 위해 정리 2라고 합시다.)
If a set contains more vectors than there are entries in each vector, then the set is linearly dependent(일차종속). That is, any set {v1, … ,vp} in Rn is linearly dependent if p > n. 여기서 p는 세트의 벡터 수이(number of vectors)고 n은 세트의 항목 수(number of entries in the vector)입니다.
여기서는 예제가 아니라 이해하기 쉽도록 이 정리(theorem)에 대한 증거(proof)를 제공합니다.
Proof

주의: 이 정리는 집합의 벡터 수(number of
vectors)가 각 벡터의 항목 수(number of entries in each vector)를 초과하지 않는 경우에 대해서는 아무 것도 말하지 않습니다.
간단한 예제:
아래 3 개의 벡터를 봅시다. 이 3 개의 벡터가 일차 종속인가?

벡터 [2 1]T, [4 -1]T, [-2 2]T은 세트에 3 개의 벡터가 있고 각 벡터에 2 개의 성분( 엔트리, entries)만 있기 때문에 위의 «정리 2(Theorem 2)»에 의해 일차 종속이다.
►그러나 벡터 중 어느 것도 다른 벡터 중 하나의 배수가 아님에 유의하십시오 (위 그림 참조).
마지막으로,
또 하나의 정리(Theorem)를 예로 봅시다.
(편리성을 위해 정리 3라고 합시다.)
If a set, let's call it S for example, S = {v1, … , vp} in Rn contains the zero vector, then the set is linearly dependent(일차 종속).
여기서는 예제가 아니라 이해하기 쉽도록 이 정리(theorem)에 대한 아주 간단한 증거(proof)를 제공합니다.
Proof
벡터의 번호를 다시 매기(renumbering the vectors)면 v1 = 0이라고 가정 할 수 있습니다. 그러면 방정식 1v1 + 0v2 + ∙∙∙ + 0vp = 0은 집합 (세트) S가 선형적으로 종속(일차 종속)임을 나타냅니다. ■
Q3. 추가답변 및 예제
저는 이상구 교수님의 매우 자세한 답변을 간략하게 요약하고 이해가 더 쉽게 하기 위해서 아주 간단한 예를 제시하겠습니다.
이제 알다시피 행렬 A의 열은 방정식 Ax
= 0 가 해로 trivial solution인 영벡터 만 갖는 경우에만(if and
only if ó) 일차 독립입니다.
예제:

이 시점에서 3 개의 기본 변수가 있고 자유 변수가(free variables) 없는 것이 분명합니다. 따라서 방정식 Ax = 0에는 trivial solution 만 있으며, 1차독립의 정의에
의하여 A의 열(columns)은 일차 독립입니다.
Comment by 유가이 올렉산드르: 학생 좋은 질문과 이상구 교수님의 자세한 답에 감사합니다. 선형 대수의 일반적인 정리(theorem)들을 사용하고, 다양한 증거(proofs)와 예제를 제공했으며, 정사각행렬을 사용하거나 사용하지 않(직관적으로)고 행렬의 독립성을 판별하는 방법을 가능한 자세하고 쉽게 설명하려고 노력했습니다. 위 내용을 도움이 되길 바랍니다.
3개의 댓글
김범준(2017****99)7월 13일 오후 7:42
그림을 통해 설명해주셔서 한층 심화된 이해가 가능한 것 같습니다.
감사합니다.
유가이올렉산드르(2018****33)7월 14일 오후 2:25
교수님이 저의 문법적으로 잘 못 쓴 것을 수정해주셔서 대단히 감사합니다.
교수님이
수정하셨던
것을 저는 다시 수정했고 올렸습니다.
이상구(LEE SANGGU)7월 14일 오후 3:07
Wonderful^^ Dear Yugai, You can write your
Question or answer in English. You are a good student^^
[Final OK by TA] Final [HW (1주차 배운 내용 요약 1] 나종진 + 유가이 : 다항함수의 개형을 그리기 + [HW] 질문 Q4. 교재 p.110(PDF p.118)와 답 by 유가이올렉산드르, 나종진, 이상구교수님
[열린문제 1] 다른 교재에서 찾은 몇 가지 다항함수(polynomial
function)의 개형을 그리시오.
Solved by 유가이 올렉산드르
For example, I want to try to show a graph drawing method for a fourth-degree polynomial function.
Problem:
Imagine that we have the
following 4th degree polynomial function(4차 다항함수):
f(x) = x4 + x3 – 3x2 – 5x – 2
It is required to draw
a graph of this polynomial function.
Solution
To
get started, let's try to draw a graph manually(by the hand):

Note
that: manually,
we can only approximately predict what the graph of a given polynomial function
of degree 4 will look like.
Now, let's use
Python to plot the same polynomial function of degree 4:
Code(Python):
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-2.5, 2.5, num=100) #changing the value of
"num" => adjust the accuracy of the graph
fx = []
for i in range(len(x)):
fx.append(x[i]**4 + x[i]**3 - 3*x[i]**2 - 5*x[i] - 2)
plt.plot(x, fx)
plt.grid()
plt.axvline()
plt.axhline()
plt.show()
Result:

Finally, let's use Sage to compare the results.
Code(Sage):
plot(x^4
+ x^3 - 3*x^2 - 5*x - 2 , (x, -2.5, 2.5))
Result:

[HW] 질문 공유,
경영학과 나종진
, Q4. 교재 p.110(PDF p.118)을 보면
A=QR ...
안녕하세요. 경영학과 나종진입니다.
1주차 강의 내용을 예습하면서 정리/ 질문한 내용입니다.
제가 많이 부족하여 이해가 되지 않는 부분을 질문으로 올렸습니다.
혹시 알고계신 분은 설명 부탁드립니다.
1. 점과 평면사이의 거리를 구하는 방법에 대한 질문
http://matrix.skku.ac.kr/2018-album/LA-Sec-1-3-lab.html
정리. [점과 평면 사이의 거리]
점 P0(x0,y0,z0)와 평면 π:ax+by+cz+d=0사이의 거리 D는 다음과 같다.
D=|ax0+by0+cz0+d|a2+b2+c2√

위의 그림에서 P(x,y,z)을 평면 π위의 점이라 하고 v=(x0−x,y0−y,z0−z),
n=(a,b,c)이라고 하면 D=∥projnv∥이다.
http://matrix.skku.ac.kr/CLAMC/chap1.html
(26page)


2. 여인자 전개에 관한 질문
http://matrix.skku.ac.kr/CLAMC/chap4.html
22 page

3. QR분해에서 행벡터와 열벡터의 차이에 대한 질문

4.
QR분해 중 식을 변환하는 과정에 대한 질문
http://matrix.skku.ac.kr/CLAMC/chap7.html
page 60


http://matrix.skku.ac.kr/LA-Lab/7-8/7-8.htm
LA Sec 7.8 QR-Decomposition; Householder transformations (https://youtu.be/gQ7gxTx5f9k)
감사합니다.
인공지능을위한기초수학
[HW]
1주차 나종진
[문제] 그래프 x*sin(1/x) 의 개형을 그리시오.
[문제] 합성함수 sin(e^(1/3)^x) 의 그래프를 그리시오.
1주차 내용 요약 및 질문
1. 스칼라와 벡터에 대해서 배웠다.
2. 노름과 내적을 구하는 법을 배웠다.
2-1. x ∙ y=∥x∥∥y∥cosθ -> x ∙ y=0이면 직교
3. 정사영에 대해서 배웠고 정사영을 이용하여 점과 평면사이의 거리를 구했다.
3-1. 평면의 방정식 : 법선벡터와 한 점을 배웠다.
한 점 P₀(x₀,y₀,z₀)를 지나고 0이 아닌 벡터 n=(A,B,C)에 수직인 벡터들이 이루는 평면π 는 A(x-x₀)+B(y-y₀)+C(z-z₀)=0 이다.
Q1. 정사영을 구하는 공식을 통해 점과 평면사이의 거리를 구하는 방법을 확인해보면 w의 노름을 구하면 된다고 생각했다. 하지만 예제 5번을 보면 p의 노름을 구하는 것과 답이 다르다. 아래 공식을 구하는 식과 p.norm()과의 차이는 무엇인가?
4. 선형연립방정식과 첨가행렬을 배웠다.
5. ERO를 통해 REF와 RREF를 구하는 방법을 배웠고 RREF를 통해 방정식의 해를 구하는 법을 배웠다.
5-1. RREF의 마지막 행이 0인 경우 무수히 많은 해가 존재하며 선행성분이 없는 열에 대해서는 자유변수로 만들어 해를 찾는다.
6. 행렬간의 연산, 전치행렬의 성질 등을 배웠다.
7. 역행렬과 역행렬을 구하는 방법, 역행렬을 통해 방정식의 해를 구하는 방법을 배웠다.
8. 다양한 행렬을 배웠다. (대각선행렬, 단위행렬, 스칼라행렬, 대칭행렬.)
9. 치환행렬과 행렬식을 배웠다.
10. 여인자와 수반행렬을 배우고 이를 통해 가역행렬의 역행렬을 구하는 방법을 배웠다.
Q2. 여인자 전개 시 임의의 3차의 정사각행렬 에 대하여 A*abjA==*가 성립함이 이해가 되지 않습니다.
[실습]
A = random_matrix(ZZ, 3, 3) # 임의의 3x3 정수(ZZ) 행렬 A를 생성!
detA=A.det() # 행렬 A의 행렬식
adjA=A.adjoint() # 행렬 A의 수반행렬
print("행렬 A")
print(A)
print("행렬 A의 수반행렬")
print(adjA)
print("A*adjA
=")
print(A*adjA)
print("행렬 A의 행렬식")
print(detA)
11. 크래머 공식을 이용하여 선형연립방정식의 해를 구하는 방법을 배웠다.
12. 일차독립, 일차종속을 배우고 행렬식이 0이 아니면 일차독립임을 배웠다.
13. 부분공간에 대해서 배웠다.
(예습간 이해 부족으로 부분공간에 대한 참고 동영상을 확인하여 더 공부를 해야된다.
벡터 덧셈에 닫혀있다. 스칼라배에 닫혀있다. 라는 조건만으로는 이해가 되지 않는다. 실제 실습을 해봐야겠다.)
14. 기저와 차원을 배웠다.
(Rⁿ의 기저인 집합 S 와 Rⁿ의 r(>n)개의 벡터 집합 T와의 관계에 대해서 공부해야한다. “각 기저에 속하는 벡터의 개수는 항상 같다.”에 말하는 각 기저는 n의 개수가 같은 집합만을 말하는 것인가? 그렇다면 n보다 작은 갯수의 벡터 집합도 기저인가? 기저가 아닐 수 도 있는 것인가? )
15. Rank-Nullity 정리를 배웠다. rank+nullity=n(col의 개수)
16. W의 직교인 벡터들의 집합을 배웠다.
17. 최소제곱해를 배웠다.
18. QR분해를 배웠다.
Q3. 교재 p.105(PDF p.113)을 확인하면 “m*k행렬 A가 k개의 일차독립인 열들을 가지면 여기에 Gram-Schmidt의 정규직교화과정을 적용하여 얻은 정규직교벡터들을 열로하는 행렬 Q를 만들어 A=QR로 분해가 된다”라고 쓰여있다. 나는 이 부분을 그 위의 Gram-Schmidt의 정규직교화과정(정규화한 직교기저를 행으로 하는 행렬)을 통해 나온 행렬에 transpose()를 하게 되면 행과 열이 바뀌어 Q가 나온다고 생각하였다.
하지만 Gram-Schmidt의 정규직교화과정문제인 예제 5번의 공식을 이용해 QR분해 문제인 예제 6번을 적용하게 되면
이러한 결과가 나오게 된다.
결과가 답과 달라 풀이처럼 w1,w2,w3를 열벡터로 하는 행렬로 풀어보니
이렇게 올바른 답이 나오게 된다.
어찌해서 이런 차이가 나오는지 궁금하다.
Q4. 교재 p.110(PDF p.118)을 보면
A=QR
…
9개의 댓글
이상구(LEE SANGGU)7월 12일 오후 4:13
경영학과 나종진 군,
질문 아주 좋습니다.
위에서 구체적으로 이해가 안되는 부분은 어디인가요?
이상구(LEE
SANGGU)7월 12일 오후 4:15
그리고 질문은 한번에 하나씩
(구체적으로
... 어디에서 어디로 가는 단계가 이해가 안 간다고 정확하게)
질문 하면,
누구라도 답을 주기가 훨씬 쉬울 것이고,
또 본인도 이해가 쉽고,
동시에 참여 회수도 공평하게 반영될 것 이랍니다.
이상구(LEE
SANGGU)7월 12일 오후 4:27
Q2. 여인자 전개 시 임의의
3차의 정사각행렬
A=[a_ij]에 대하여
A*adjA = |A|*In 가 성립함이 이해가 되지 않습니다. <--- 답 ^^ 행렬식의 정의와 성질에서 자연스럽게 따라 나오는 성질
[Laplace 여인자 전개]
입니다.
위의 증명 또는
http://matrix.skku.ac.kr/sglee/linear/ocu/20302.html 을 한번 읽어 더 보시고
... 그래도 이해가 안되면 다시 한번 물어 보세요^^
이상구(LEE
SANGGU)7월 12일 오후 4:33
Q1. 정사영을 구하는 공식을 통해 점과 평면사이의 거리를 구하는 방법을 확인해보면
w의 노름을 구하면 된다고 생각했다.
하지만 예제
5번을 보면
p의 노름을 구하는 것과 답이 다르다.
아래 공식을 구하는 식과
p.norm()과의 차이는 무엇인가?
<--- 위의
26쪽 그림을 보시면 최단거리는
Projection of x onto normal vector n 인 p 의
norm 이 바로 그 벡터에서 평면까지의 최단 거리이므로 우리가 구하는 최단거리는
p 의
norm 입니다.
이상구(LEE
SANGGU)7월 12일 오후 4:36
Q3. 교재
p.105(PDF p.113)을 확인하면 “m*k행렬 A가
k개의 일차독립인 열들을 가지면 여기에
Gram-Schmidt의 정규직교화과정을 적용하여 얻은 정규직교벡터들을 열로하는 행렬 Q를 만들어 A=QR로 분해가 된다”라고 쓰여있다.
<--- 맞습니다.
자세히 들어가면 기초수학을 조금 넘어서니까 지금은 우선은
A 의
column vector 들을 Gram-Schmidt의 정규직교화과정(정규화한 직교기저를 행으로 하는 행렬)
하는 과정으로 이해 하시면 됩니다.
Math for Big Data, Lecture 5, QR Decomposition, https://youtu.be/gQ7gxTx5f9k (이 강의는 대학원생 대상으로 수준이 약간 높으나 아주 자세히 모든 과정을 설명해 준 것입니다.
다 이해 못하셔도 되니까 전혀 부담 느끼지 마세요)
위에 소개한
QR 분해 에 대한 전체적인 글을 다시 한번 읽고 대략 이해 하시면 합니다.
그리고 질문을 다듬어서 한번 더 질문해 주세요^^
이상구(LEE
SANGGU)7월 12일 오후 4:41
Q4. 교재
p.110(PDF p.118)을 보면 A=QR A^T Ax=A^T b <=> 〖(QR)〗^T
(QR)x=〖(QR)〗^T b <=> R^T Q^T (QR)x=R^T Q^T b <=> R^T Rx=R^T Q^T
b <=> Rx=Q^T b 이 식에서 R^T Q^T (QR)x=R^T Q^T b <=> R^T
Rx=R^T Q^T b <--- 답^^ (AB)^T = B^T A^T 이고 직교행렬
Q 의 경우,
Q^T Q = I (항등행렬)
이므로
, 마지막 줄의 항등식 양 변이 같아지는 것입니다.
나종진(2017****17)7월 13일 오후 5:10
감사합니다.
다시 한번 확인한 후 이해가 안되는 부분은 다시 질문드리겠습니다.
나종진(2017****17)7월 13일 오후 11:56
추가 질문입니다.
QR분해는 보내주신 유튜브를 보고 열벡터를 정규직교화과정으로 하는 것이 이해가 되었습니다.
말씀해주신대로 다 이해하기는 어려웠습니다.
^^ 교재에서 나와있는 내용을 통해 열심히 공부해보겠습니다.
추가 질문은
Q2. 여인자 전개에 관한 질문입니다.
보내주신 사이트로 들어가서 정리
2.12번 증명을 확인해보니 사진 화질이 좋지않아 잘 보이지 않았습니다.
A*adjA에서
i와
j가 같을 때
|A|가 되는 것은 이해가 됩니다.
하지만 대각이 아닌 부분인
i와
j가 다를 때는 왜
0이 되는지 궁금합니다.
이상구(LEE
SANGGU)7월 15일 오전 11:51
그 부분인
Laplace 여인자 전개로 답은 위에 주었습니다.
행렬식의 성질 중 두 행이 같으면 행렬식의 값이
0 이다 는 성질을 이용한 것입니다.
[Final OK by TA and
SGLee] Final by 천가영, 유가이 and SGLee [HW] 벡터에 관한 질문 by 천가영 <- 답변 by 유가이
[HW] 벡터에 관한 질문
질문 by 천가영
답변 by 유가이 올렉산드르
Final
by 유가이 and SGLee
벡터를 배우게 된 것은 이번 수업이 처음이라
궁금한 것이 생겨서 질문드립니다.
1. 벡터는 크기와 방향을 갖는 유향선분 - 2차원, 3차원 공간의 벡터는 화살표로 표현 가능
-> 1차원 벡터도 존재하나요? (답: 존재합니다)
만약 존재한다면 1차원 벡터는 화살표로 표현 불가능한가요? (답: 화살표로 표현하지 못하는 벡터들도 존재합니다)
아니면 1차원은 공간으로 간주되지 않아서 그런 것인가요? (답: 아닙니다. 1차원 벡터 공간도 존재합니다)
2. (R^n 안의) 벡터 X의 노름은 원점에서 점 P(x1, x2, ... , xn)에 이르는 거리로 정의됨을 의미한다.
-> 아래의 그림과 같이 시점이 원점이 아닌 벡터는 두 벡터의 합으로 밖에는 표현할 수 없나요?
(답: 아닙니다. 자세한 설명은 아래를 보세요^)

************
Answer #1:
먼저 차원에 대해서 간단하게 설명하고 예를 들겠습니다.
<In mathematics, the dimension of an
object is, roughly speaking, the number of degrees of freedom of a point that
moves on this object. In other words, the dimension is the number of
independent parameters or coordinates that are needed for defining the position
of a point that is constrained to be on the object. For example, the dimension
of a point is zero; the dimension of a line is one, as a point can move on a
line in only one direction (or its opposite); the dimension of a plane is two,
etc. Note: The dimension is an intrinsic property of an object, in the sense
that it is independent of the dimension of the space in which the object is or
can be embedded. For example, a curve, such as a circle is of dimension one,
because the position of a point on a curve is determined by its signed distance
along the curve to a fixed point on the curve. This is independent from the
fact that a curve cannot be embedded in a Euclidean space of dimension lower
than two, unless it is a line.>
차원(次元)은 수학에서 공간 내에 있는 점 등의 위치를 나타내기 위해 필요한 축의 개수를 말한다.
0차원 점이 움직여 1차원 선이 되고, 선이 움직여 2차원 면이 되고,면이 움직여 3차원 입체가 되고, 입체가 움직여 4차원 초입체가 된다.
위의 모든 것을
이해가 조금 더 쉽게 하도록 시각화하려고 노력할 것입니다.
1차원 벡터공간 안의 모든 벡터들은 1차원 벡터들입니다.
예를들어 (R상의) 실수집합 R 은 1차원 벡터공간의 예입니다.
이 R 의 모든 원소는 1차원벡터입니다.
아래 그림을 참조하세요.

Figure 1
=> 따라서 1차원 공간이 존재하고,
그 안에 1차원 벡터들이 존재합니다.
벡터공간에 대한 개념 http://matrix.skku.ac.kr/LA-K/Ch-9/ http://matrix.skku.ac.kr/LA/Ch-9/
http://matrix.skku.ac.kr/LA-Lab/9-1/9-1.html
을 먼저 읽어보세요.
1차원 벡터공간 안의 모든 벡터들은 1차원 벡터들입니다.
예를들어 (R상의) 실수집합 R 은 1차원 벡터공간의 예입니다.
이 R 의 모든 원소는 1차원벡터입니다.
행렬들의 집합도 벡터공간을 이룹니다. 이 경우 성분인 행렬들이 벡터 입니다.
![]()
Let
be
the set of all
matrices
with real entries. That is,
.
When
, we
denote
by
.
If
is
equipped with the (usual) matrix
addition and the scalar multiplication,
then
form
a vector space
over
.
The zero vector is the zero
matrix
and
for each ![]()
, the
negative vector is
.
Note that each
vector in
means
an
matrix
with real entries. ■
![]()
Let
be
the set of all continuous functions from
to
. That
is,
is continuous}
Let
and
a scalar
,
define the addition and the scalar multiple as
,
.
Then
forms
a vector space
over
.
The zero vector is
(zero
function) and for each
,
is
defined as
.
Vectors in
mean
continuous functions from
to
. ■
![]()
Let
be
the set of all polynomials of degree at most
with
real coefficients. In other words,
![]()
Let
and
a scalar
.
The addition and
the scalar multiplication are defined as
![]()
.
Then
forms
a vector space
over
.
The zero vector
is
zero
polynomial and each
has
the negative vector
defined
as
.
Vectors in
means
polynomials of degree at most
with
real coefficients.■
https://twlab.tistory.com/m/15
예제:
For the
vectors in 1D I'm
assume that my dimension is a line. If it’s a line then I can put a coordinate
system along that line. In that coordinate system, let’s call it x, we have positive x-direction, negative x-direction and origin (See
Figure 2.1 below). In one direction vectors can only point one of two
directions, they can point either in the positive x or negative x direction.

Figure
2.1
Let's assume that we have a positive vector a,
and a negative vector b (see
Figure 2.2).

Figure
2.2
Let
the vector a has a magnitude of 2m and
the vector b has a magnitude of -3m.
(Little note: In kinematics, the simplest motion is motion in one-dimensional
space. Some examples of one-dimensional motions are: a car moving on a straight
road; a person walking down a hallway; a sprinter running on a straight race
course.)
As
you can see from the example above, our a and b have both size (2m and -3m)
and direction (positive and negative).
Please note, in our case, the sign in front of the value indicates
the direction.
Thus,
we can conclude that a and b are vectors in one-dimensional space. ■
All
operations on vectors are possible here. For example, the addition of vectors.
Using the “Tales to tip” method, we add the vector a to vector b (see
figure 2.2).

---------------------------------------------------------------------------------------------------------------------------
Answer #2. 네, 맞습니다. 시점이 원점이 아닌 벡터도 다양한 방법으로 표현하면 됩니다.
When we think of
a point in Rn as
a vector, we will usually write it vertically, like a matrix with one column:

We will also write 0 for
the zero vector.
Why make the distinction between points
and vectors? A vector need not start at the origin: it
can be located anywhere. In other words, an arrow is
determined by its length and its direction, not by its location. For instance,
these arrows all represent the vector (1, 2).

However, unless
otherwise specified, we will assume that all vectors start at the origin.
Remark:
Note Another way to think about a vector
is as a difference between two points, or the arrow from one point to another.
For instance, [1 2]T is the
arrow from ( 1, 1 ) to ( 2, 3 ) .

예제 1:

예제 2 (Vectors with Initial Points NOT
at The Origin):
For example, consider a vector that has its initial point at P(2,2) and terminal point at Q(6,3). To draw this
vector, we can plot these coordinates and connect them as a vector.
Alternatively we can denote this vector with a general set of components:
vector PQ = (xQ − xP, yQ − yP)
For our
example, vector PQ = (4, 1), and the following
graphic illustrates our vector in two ways:
■
Reference:
for more information with examples, you can visit the following site: https://textbooks.math.gatech.edu/ila/vectors.html
(Please
note that in the new I-campus there is no way to directly insert some
mathematical notation, matrices, vectors, etc., so I tried to replace
everything with words and accessible characters.)
주로 영어로 답변을 드렸는데 죄송합니다. 도움이 되면 좋겠습니다.
벡터의 노름 은 아래와 같이 정의 됩니다.
http://matrix.skku.ac.kr/LA/Ch-1/
https://leebaro.tistory.com/entry/norm%EB%85%B8%EB%A6%84%EC%9D%98-%EC%A0%95%EC%9D%98
행렬도 벡터의 예이고 노름을 갖습니다.
연속함수도 벡터의 예이고 노름 을 갖습니다.
벡터(vector): 속도, 위치이동, 힘
- 크기뿐만 아니라 방향까지 지정하지 않으면 완전히 표현할 수 없는 양
벡터는 크기와 방향을 갖는 유향선분 - 2차원,
3차원 공간의 벡터는 화살표로 표현 가능

http://matrix.skku.ac.kr/LA-K/Ch-1/LA-Lab-kor-Ch-1.html
시작점과 끝점이 같아서 크기가
인 벡터를 영벡터라 한다(영벡터는 크기가
이므로 방향은 임의의 방향으로 한다).


좌표평면
에 서 원점을 시작점으로 하는 모든 벡터는 끝점에 의해 크기와 방향이 결정된다. 그런데 벡터는 크기와 방향이 같으면 시작점에 관계없이 항상 동일한 벡터로 간주하므로 (앞으로 원점을 항상 시작점으로 생각하기로 약속하면) 모든 벡터는 점의 좌표를 이용하여 나타낼 수 있다.
시점이 원점이 아닌 벡터는 원점으로 옮겨놓고 norm 노름을 구하시면 됩니다
Finalized by 유가이 올렉산드르 2-1강에 대해 질문 by 이상현, 답변 by 이상구 교수님
[HW] 2-1가에 대해 질문 (Gauss-Jordan 소거법)
질문 by 이상현
답변 by 이상구 교수님
Finalized by 유가이 올렉산드르
Q: Gauss-Jordan 소거법을 프로그램으로 하지않고 직접 해보고 싶습니다. 방법을 알려주세요.
A: 10차 행렬 을 가우스 소거법 http://matrix.skku.ac.kr/sglee/linear/ocu/20104.html
... 손으로 구하는 과정은 ... 이 인공지능 수학에서는 이해하는 것이 골이고, 손으로 직접 계산하고 는 것은 선택입니다.
축가 답변:
Gauss-Jordan 소거법을 사용하기 전에 다음 개념을 명확하게 이해해야 합니다.
►
Definition(정의):
Gauss-Jordan Elimination is an algorithm that can be used to solve systems of linear equations and to find the inverse(역행렬) of any invertible matrix. It relies upon three elementary row operations one
can use on a matrix:

►
Row-echelon form(행 사다리꼴/REF)과 Reduced row echelon form(기약 행 사다리꼴/RREF)
● mxn 행렬 E가 다음 성질을 만족할 때, 행 사다리꼴(Row-echelon form)이라고 한다.
(i) 성분이 모두 0인 행이 존재하면 그 행은 행렬의 맨 아래에 위치한다.
(ii) 각 행에서 처음으로 나타나는 0이 아닌 성분은 1이다. 이때, 이 1을 그 행의 선행 성분(leading
entry)이라고 한다.
(iii) i 행과 i+1 행 모두에 선행성분이 존재하면 (i+1) 행의 선행성분은 i 행의 선행 성분보다 오른쪽에 위치한다.
● 또, 행렬 E 가 행사다리꼴이고 아래의 성질도 만족하면 E를 기약 행 사다리꼴 (reduced
row echelon form)이라고 한다.
(iv) 어떤 행의 선행성분을 포함하는 열(column)의 다른 성분은 모두 0이다.

Matrices A and B are in
reduced-row echelon form, but matrices C and D are
not. C is
not in reduced-row echelon form because it violates conditions two and
three. D is
not in reduced-row echelon form because it violates condition four (Note
that, D is
in Row-echelon form). In addition, the elementary row operations can be used to
reduce matrix D into
matrix B.
► Steps for
Gauss-Jordan Elimination(Gauss-Jordan 소거법)
► 이 Gauss-Jordan 소거법 하는 방법을 이해하기 쉽도록 간단한 예제를 풀어 보겠습니다.

*Note:
참고 문헌:
[1] http://matrix.skku.ac.kr/sglee/linear/ocu/20104.html
[2] https://online.stat.psu.edu/statprogram/reviews/matrix-algebra/gauss-jordan-elimination
1개의 댓글
이상구(LEE SANGGU)7월 18일 오후 5:51
다른 학생은 여기에 본인 생각을 보태 보세요^^
add your comment
[Final OK by SGLee] Finalized by 한수현, 유가이 올렉산드르, 박지수] [HW-해공간을 구하는 법, f Kernel(Null Space), Right Null Space, Left Null Space
[Final OK by SGLee] Finalized
by 한수현, 유가이 올렉산드르, 박지수] [HW-해공간을 구하는 법, f Kernel(Null Space), Right Null Space, Left Null Space
Final OK by SGLee [HW-해공간을 구하는 법, finalized by 한수현,
re-finalized by 유가이 올렉산드르] Kernel(Null Space), Right Null Space,
Left Null Space, 질문 by 박지수, 답변
[HW] 해공간을 구하는 법, Span <(-3, 1, 0, 0), (-5, 0, -2,
1)>이 해공간, Kernel(Null Space), Right Null Space, Left Null Space
질문 by 박지수
답변 및 Finalized by 한수현
Final OK by SGLee
추가 답변 및 Re-finalized by 유가이 올렉산드르
Q:


교재 p92 예제2 답이 나오지 않아서 제가 무엇을 잘못하고 있는지, 어떻게 푸는 것인지 질문드립니다.
A:
Final. 해공간, 박지수 학우님의 질문에 대한 답. Span 인 <(-3, 1, 0, 0), (-5, 0,
-2, 1)>이 해공간 입니다.

풀이는 이런 식으로 하면 될 것 같습니다.
해공간을 표현하는데 사용하는 두 벡터는 해공간에 속해있는 무수히 많은 벡터 중 두 개를 끌어오면 되는 것이기 때문에 해공간의 표현은 다양하게 할 수 있습니다.
저 마지막 식에서 (x2, x4)가 (3, -2)일 때 해는 (1, 3, 4, -2)이고, (5, -3)일 때 해는 (0, 5, 6, -3)이므로 제가 구한 span(S)에는 예제 답에 나와있는 두 해가 포함 되어있으므로 제가 쓴 <(-3, 1, 0, 0), (-5, 0, -2, 1)>도 해공간의 표현 중 하나임을 알 수 있습니다.
박지수 학우님도 저와 같은 답이 나오셨던데, 그 답도 맞다고 보면 될 것 같습니다.
추가 답변:
► Definitions
● Subspace
A subspace of a vector V is a subset H of V that has three properties:
(1) The zero
vector of V is
in H.
(2) H is closed
under vector addition. That is, for each u and v in H, the sum u + v is
in H.
(3) H is closed under
multiplication by scalars. That is, for each u in H and each
scalar c,
the vector cu is
in H.
Note that, properties (1), (2), and (3) guarantee
that a subspace H of V is itself
a vector space, under the vector space operations already defined in V.
Remark: The best way to test for a
subspace is look first for the zero vector. If 0 is
in H,
then properties (2) and (3) must be
checked. If 0 is
not in H,
then H cannot
be a subspace and thee other properties need not to be checked.
● Null Space
The
null space of an mxn matrix A, written as Nul A, is the set of
all solutions of the homogeneous equation Ax = 0. In set notation,
Nul A = {x : x is in Rn and Ax = 0}
Remark:
A more dynamic description of Nul A is the
set of all x in Rn that are mapped
into zero vector of Rm via the linear
transformation x
-> Ax. See Figure 1 below.

Figure 1
Important Theorem:
The null space of an mxn matrix A is a
subspace of Rn. Equivalently, the set
of all solutions to a system Ax
= 0 of m homogeneous
linear equations in n unknowns
is a subspace of Rn.
Proof:
First, notice that Nul(A) is
a subset of Rn, because A has n columns (Nul(A) ⊆ Rn).
So, we need to check the 3 properties(see above) of a
subspace:
1. It’s
clear that 0 is
in Nul(A).
2. Let u and v be any
two vectors in Nul(A).
Then we have:
3. Finally, if c is
any scalar, then:
Thus, Nul(A) is
a subspace of Rn. ■
► 위에 있는 예제2의 결과를 다시 한 번 살펴봅시다.
After we decompose the vector giving the general solution into a
linear combination of vectors where the weight are the free variables, we
obtain the following:

Figure 2
Note that, every linear
combination of u and v is an element
of Nul A and
vice versa. Thus {u,
v} is a spanning set for Nul A.
Two points should
be made about the solution of this Example 2 that apply to all problems of this
type where Nul
A contains nonzero vectors.
To consolidate the material, I will
show an example of how you can easily determine whether a given vector x, for example, is in Nul A, using the given matrix from
Example 2.


This means all four vectors x are in the null space of A.
Interesting fact #1:
► Right kernel(null space) vs Left kernel(null space)
The usual kernel(null space) is
what we are calling the “right
kernel”. The "left
kernel" is the cokernel and can be computed as
the kernel of the
matrix's transpose.
Left null space:
The left null space, or
cokernel, of a matrix A consists
of all column vectors x such
that xTA = 0T, where T denotes
the transpose of a matrix. The left null space of A is the
same as the kernel of AT. The left null space
of A is
the orthogonal complement to the column space of A, and is dual
to the cokernel of the associated linear transformation. The kernel, the row
space, the column space, and the left null space of A are the
four fundamental subspaces associated to the matrix A.
Sage example of right and
left kernel:

Interesting fact #2:
► Sage library vs Python Sympy library
I'm not sure which library Sage uses,
however, for example, the Numpy math library in Python uses the exact same
method for finding the Null Space matrix that we usually use when solving manually.
Note that, the both results are correct (see the explanation
above), but the method using the Sympy library seems to me more convenient.
Below I have compared the results from Sage and Python Sympy.
Sage:

Python “Sympy”:

[참고]:
[1] https://en.wikipedia.org/wiki/Kernel_(linear_algebra)
[2] https://www.geeksforgeeks.org/null-space-and-nullity-of-a-matrix/
1개의 댓글
김호연(2020****32)7월 22일 오후 11:25
좋은 내용 알아갑니다.
감사합니다~~
[Final
OK by TA] [Final] Q by 김진웅 A by 유가이올렉산드르, 이상구 F
by 김진웅 [HW 질문] 서로 같은 고유값에 대응하는 고유벡터들 차원
(JCF)
[HW 질문] 서로 같은 고유값에 대응하는 고유벡터들 차원
질문
by 김진웅
답변
by 유가이올렉산드르, 이상구
Finalized
by 김진웅
어떤 행렬 A 와 B 가 주어졌을 때 ...
서로 같은 (중근의) 고유값에 대응하는 (일차독립인)
고유벡터들이 이루는
부분공간 (eigenspace) 의 차원이 다를 때가 있는데 ...
어떻게 구분하여 알 수 있나요?
A 의
닮은 대각선행렬
: ![]()
B 의
닮은 대각선행렬 :
라는 의미는?
무엇인가요?
유가이올렉산드르(2018****33)7월 21일 오전 2:58
Let's try to analyze the given example.
The first matrix "D = ([[1, 0], [0,
1]])" has two eigenvalues (1 and 1) but they are obviously not distinct.
Since A is the identity matrix, Av=v for any vector v, i.e. any vector is an
eigenvector of A. We can thus find two linearly independent eigenvectors (say
<-2,1> and <3,-2>) one for each eigenvalue.
But, the second matrix "D = ([[1, 0],
[1, 1]])" also has non-distinct eigenvalues of 1 and 1. All eigenvalues
are solutions of (A-I)v=0 and are thus of the form <t,0>. Hence, in this
case there do not exist two linearly independent eigenvectors for the two
eigenvalues 1 and 1 since <t,0> and <s,0> are not linearly
independent for any values of s and t.
Remark 1: Every eigenvalue with multiplicity
= n will be associated with n different (as in linearly independent)
eigenvalues.
Multiplicity is how many "times" it
shows up as an eigenvalue. It is like when you find only one solution to a
second degree equation, which always has two roots. This solution has a
multiplicity = 2.
Remark 2: If a matrix has more than one
eigenvector the associated eigenvalues can be different for the different
eigenvectors.
Geometrically, the action of a matrix on one
of its eigenvectors causes the vector to stretch (or shrink) and/or reverse
direction.
이상구(LEE SANGGU)7월 21일 오전 4:17
Good.
1. 답은 Ax =
lamda x 의 해공간의 차원 은 2 이고,
Bx = lamda x 의 해공간의 차원은 1 이 라는 의미입니다.
즉, A 의 고윳값 1은 고유공간의 차원은 2 이고,
B의 고유공간의 차원은 1 이라는 의미입니다.
고유공간(eigenspace) 에 대하여 좀 더 알아봅시다.
2. 더 자세히 설명하자면
행렬에 대응하는 고유값들은 여러분들이 이미 알고 있는 (대수적) 중복도를 가질 수 있습니다.
지금 물어본
그리고 유가이 군이 아주 자세히 준 설명은 , 고윳값에 대한
기하적 중복도
(Geometric multiplicity) 라는 새 개념 입니다.
1. 고윳값에 대응하는 기하적중복도는 그 고윳값에 대응 하는 일차독립인 고유벡터들의 개수 를 의미 합니다. 또 고윳값 lamda 에 대해 Ax = lamda x 의 해공간의
차원도 lamda 의 기하적 중복도 와 일치 합니다. 그래서 기하적 중복도는 연립 방정식을 풀어서 구하면 됩니다.
3. 즉 위의 둘이 기하적 중복도에 대한 같은 정의 입니다.
4. 여러분들은
지금 단계에서는 대충 그렇게만
알고 지나가시고, 보통 선형대수학
입문의 9장 Jordan 표준형 http://matrix.skku.ac.kr/JCF/ 배울때
Jordan 표준형을 구하라는
문제를 풀면서
자동으로 각 고윳값의 기하적 중복도를 한눈에 확인 합니다.
더 자세한 내용은
JCF 에서 천천히
배우면 됩니다.
5. JCF 은 명령어 하나로 쉽게 구하도록 만들어 두었습니다. http://matrix.skku.ac.kr/JCF/
5. 그것을 보시면 각 고윳값에 대응하는 Jordan block 의 개수가 그 고윳값의 기하적 중복도 임을 너무 쉽게 알 수 있습니다.
인공지능 기초수학
에서는 그 정도 만 아시면 됩니다.
스스로
진지하게 인공지능에 필요한 수학 내용을 스스로
깨우쳐가는 좋은 질문과 답을 하는 여러분들을
Respect
합니다. ^^
Final comment:
위에 D_1 의 고유값 1은 대수적 중복도가 2, 기하적 중복도가 2이고,
밑에 D_2의 고유값 1은 대수적 중복도가 2, 기하적 중복도가 1인 것이군요.
기하적 중복도라는 새 개념이 있다는 것과 JCF를 배우면 기하적 중복도를 알 수 있다는 것을 알았습니다.
모두 좋은 답변들 감사드립니다.
|
|
http://matrix.skku.ac.kr/knou-knowls/cla-week-11-sec-8-2.html

|
|


유가이올렉산드르(2018****33)7월 21일 오전 2:58
Let's
try to analyze the given example. The first matrix "D = ([[1, 0], [0,
1]])" has two eigenvalues (1 and 1) but they are obviously not distinct.
Since A is the identity matrix, Av=v for any vector v, i.e. any vector is an
eigenvector of A. We can thus find two linearly independent eigenvectors (say
<-2,1> and <3,-2>) one for each eigenvalue. But, the second matrix
"D = ([[1, 0], [1, 1]])" also has non-distinct eigenvalues of 1 and
1. All eigenvalues are solutions of (A-I)v=0 and are thus of the form
<t,0>. Hence, in this case there do not exist two linearly independent
eigenvectors for the two eigenvalues 1 and 1 since <t,0> and <s,0>
are not linearly independent for any values of s and t. Remark 1: Every
eigenvalue with multiplicity = n will be associated with n different (as in
linearly independent) eigenvalues. Multiplicity is how many "times"
it shows up as an eigenvalue. It is like when you find only one solution to a
second degree equation, which always has two roots. This solution has a
multiplicity = 2. Remark 2: If a matrix has more than one eigenvector the
associated eigenvalues can be different for the different eigenvectors.
Geometrically, the action of a matrix on one of its eigenvectors causes the
vector to stretch (or shrink) and/or reverse direction.
이상구(LEE
SANGGU)7월 21일 오전 4:17
Good.
1. 답은
Ax = lamda x 의 해공간의 차원 은 2 이고, Bx = lamda x 의 해공간의 차원은
1 이 라는 의미입니다.
즉,
A 의 고윳값
1은 고유공간의 차원은
2 이고,
B의 고유공간의 차원은
1 이라는 의미입니다.
고유공간(eigenspace)
에 대하여 좀 더 알아봅시다.
2. 더 자세히 설명하자면 행렬에 대응하는 고유값들은 여러분들이 이미 알고 있는
(대수적)
중복도를 가질 수 있습니다.
지금 물어본 그리고 유가이 군이 아주 자세히 준 설명은
, 고윳값에 대한 기하적 중복도
(Geometric multiplicity) 라는 새 개념 입니다. 1. 고윳값에 대응하는 기하적중복도는 그 고윳값에 대응 하는 일차독립인 고유벡터들의 개수 를 의미 합니다.
또 고윳값
lamda 에 대해
Ax = lamda x 의 해공간의 차원도 lamda 의 기하적 중복도 와 일치 합니다.
그래서 기하적 중복도는 연립 방정식을 풀어서 구하면 됩니다.
3. 즉 위의 둘이 기하적 중복도에 대한 같은 정의 입니다.
4. 여러분들은 지금 단계에서는 대충 그렇게만 알고 지나가시고,
보통 선형대수학 입문의
9장
Jordan 표준형
http://matrix.skku.ac.kr/JCF/ 배울때
Jordan 표준형을 구하라는 문제를 풀면서 자동으로 각 고윳값의 기하적 중복도를 한눈에 확인 합니다.
더 자세한 내용은
JCF 에서 천천히 배우면 됩니다.
5. JCF 은 명령어 하나로 쉽게 구하도록 만들어 두었습니다.
http://matrix.skku.ac.kr/JCF/ 5. 그것을 보시면 각 고윳값에 대응하는
Jordan block 의 개수가 그 고윳값의 기하적 중복도 임을 너무 쉽게 알 수 있습니다. 인공지능 기초수학 에서는 그 정도 만 아시면 됩니다.
스스로 진지하게 인공지능에 필요한 수학 내용을 스스로 깨우쳐가는 좋은 질문과 답을 하는 여러분들을
Respect 합니다.
^^
김진웅(2015****73)7월 21일 오후 12:02
위에
D_1 의 고유값
1은 대수적 중복도가
2, 기하적 중복도가
2이고,
밑에
D_2의 고유값
1은 대수적 중복도가
2, 기하적 중복도가
1인 것이군요.
기하적 중복도라는 새 개념이 있다는 것과
JCF를 배우면 기하적 중복도를 알 수 있다는 것을 알았습니다.
모두 좋은 답변들 감사드립니다.
이상구(LEE
SANGGU)7월 21일 오후 6:50
이 질문은 대학원 입학 구술시험 이나 연구소에서 사람 뽑을 때
... 선형대수학을 배웠다는 학생들에게 물어보면
... 제대로 배웠는지
... 대충 배웠는지를 확인할 수 있는 질문 중 하나 입니다^^
이상구(LEE
SANGGU)7월 22일 오후 9:25
여러분의 이해 수준이 상당히 높습니다.
1개의 댓글
채희준(2016****00)7월 27일 오전 11:04
17년도에 선형대수학을 배우면서 대수적 중복도에 대해서는 이해했으나 기하적 중복도, 고유공간에 대해서는 굉장히 어려워했던 기억이 납니다. 당시에는 좋은 성적을 받는 것이 중요하다 생각해 제대로 이해하지 않은 상태로 그냥 지나갔었는데... 이 질문과 답변을 통해 제대로 이해할 수 있었습니다. 감사합니다.
[Final OK by TA] [HW] 열공간, 해공간, 영공간 사이의 관계, 질문 by 김진웅, 답변 by 장환승, 추가답변 및
Finalized by 유가이 올렉산드르
Finalized by 유가이 올렉산드 [HW 질문] 열공간, 해공간, 영공간 사이의 관계
질문 by 김진웅
답변 by 장환승
추가답변 및 Finalized by 유가이 올렉산드르
Q: 행렬 A와 열공간 Row(A), 행공간 Col(A), 영공간 Null(A) 사이의 관계
의 증명을 알고 싶습니다.
참고: http://matrix.skku.ac.kr/LA-Lab/7-2/7-2.htm

|
|
주어진
행렬의
기본
공간들
사이의
관계 |
||
|
|
|
|
|
|
|
● ● Row( ● Col( |
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
http://matrix.skku.ac.kr/nla/rank-review/Reciew-rank.htm
Main Theorem Let
TFAE
(1) A가 invertivle
(2) det A
0
(3) A ~
(row equivalent)
(4) A는 Elementary matricces의
product
(5) PA=LDU with all
0
(6) Ax=b has a solution ![]()
(7) N(A)={0}
(8) A의 col's가 가 L.I
(9) C(A) =![]()
(10) A has a left inverse
(11) rank A = n
(12) A의 row's가 L.I
(13) R(A)=![]()
(14) A has a right inverse
(15)* L.T A :
via A(x)=Ax 가 단사
(16)* 위의 L.T가 전사
(17)* 0은 A의 고유값이 아니다,
A:
u라는 벡터가 Null(A)에 속하는 벡터라고 하고
v라는 벡터는 Row(A)에 속하는 벡터라고 하면,
AT = [w1 w2 ... w(n)] 이라고 하면 (크기가 n)
v = a1w1 +
a2w2 +
.... + anwn
v = (AT)a
aT = [a1 a2 .... an]
u*v(내적) = (uT)v = (uT)(AT)a = ((Au)T)a = (0T)a = 0
따라서 Row(A)⊥ = Null(A) 입니다.
T 는 transpose 를 의미합니다.
추가 답변:
► 아래에 증명에도 참고하세요.
1) Prove that, Row(A)⊥ =
Null(A)
Prove:


2) Prove that, Col(A)⊥ = Null(AT)
Prove:

[Final OK by SGLee] [HW] 1주차 강의 내용 요약 및 정리 + Sage과 Python 실습(비교), 내용 요약 및 정리 by 박진형, 코딩실습 및 Finalized by 유가이 올렉산드르
[Final OK by SGLee]
[HW] 1주차 강의 내용 요약 및 정리 + Sage과 Python 실습(비교), 내용 요약 및 정리 by 박진형,
코딩실습
및 Finalized by 유가이 올렉산드르
http://matrix.skku.ac.kr/KOFAC/ 에서 바로 따라서 실습해 보시면 같은 결과가 나오는 것을 알게 되실 것입니다. 여기서 행렬의 성분들과 크기를 을 바꾸어 실습하셔도 됩니다.
1주차 강의 내용 요약 및 정리 + Sage과 Python 실습
내용 요약 및 정리 by 박진형
코딩실습 및 Finalized by 유가이 올렉산드르
1주차 강의 들으며 내용 정리한 것들입니다. 선형대수학은 처음 접해보는 과목인지라 이해하기가 상당히 까다로웠습니다만 예제를 통해 이해를 하며 천천히 공부하니 점점 이해가 되었습니다. 특히 QR 분해 파트가 이해가 잘 안 갔는데, 예제들을 풀어 보면서 이해할 수 있었습니다.
0-0강 및 0-1강의 내용 요약 및 정리:



1-1강의 내용 요약 및 정리:

2-1강의 내용 요약 및 정리:




[Math-Coding-HW]
1주차 코딩실습 (Sage과 Python):
SageMath
code:
A = random_matrix(ZZ, 12,
12) # 임의의 12x12 정수(ZZ) 행렬 A를 생성
print("A =
")
print(A)
Output:

Python
code:
import numpy as np
# Create a 12x12
matrix consisting of integers ranging from 0 to 50
A =
np.random.randint(0,50,size = (12,12)) #
print("A =
")
print(A)
Output:

Sage
code:
A = matrix([[1, -1,
-4, 0, 7, -4, 1, 1, 0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
print("A =")
print(A)
print("RREF(A)
=")
print(A.rref()) #A의 RREF 구하기
Output:

Python code:
import numpy as np
from sympy import *
A = Matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
# Use sympy.rref() method
A_rref = A.rref()
print("A =")
print(format(A))
print("The Row echelon form of
matrix A and the pivot columns:")
print(format(A_rref))
Output:

SageMath code:
A = matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
print("A =")
print(A)
print
I = matrix.identity(12)
AI = A.augment(I).rref() #첨가행렬 [A : I]의 RREF 구하기
print("RREF [A : I] =")
print(AI)
print
A2 = AI.submatrix(0, 12, 12, 12) # A.submatrix(a, b, c, d)
#행렬의 (a+1, b+1) 성분부터 c개의 행,
d개의 열로 이루어진 부분행렬 구하기
print("inverse of A =")
print(A2)
Output:


Python code:
from sympy import *
A = Matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
inverse = A.inv() # calculate the
Inverse of A
print("Inverse of A =")
print(inverse)
Output:

A = matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
print("A =")
print(A)
dA = A.det() # 행렬식 구하라
adjA = A.adjoint() # 수반행렬 구하기
print()
print("inverse of A = (1/dA)*adjA =")
print((1/dA)*adjA) #수반행렬을 이용한 역행렬 구하기
Output:

Python code(for determinant and
inverse):
import numpy as np
from numpy import linalg
A = np.array([[1, -1, -4, 0, 7, -4, 1,
1, 0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
print("A =")
print(A)
print
determinant = np.linalg.det(A)
print("Determinant of A:")
print(determinant)
print
inverse = np.linalg.inv(A)
print("Inverse of A:")
print(inverse)
Output:

SageMath code:
A = matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
print("rank(A) =", A.rank())
#rank 구하기
print("nullity(A) =", A.right_nullity())
#nullity 구하기
Output:
![]()
Python code:
import numpy as np
from sympy import *
A = Matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
# Number of Columns
NoC = A.shape[1]
# Rank of A
rank = np.linalg.matrix_rank(A)
# Nullity of the Matrix
nullity = NoC - rank
print("Rank:")
print(rank)
print("Nullity: ")
print(nullity)
Output:

SageMath code:
A = matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
nsp = A.right_kernel()
print("Null space of A:")
print(nsp)
Output:

Python code:
from sympy import *
A = Matrix([[1, -1, -4, 0, 7, -4, 1, 1,
0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
# Null Space of A
NullSpace =
A.nullspace() # Here NullSpace is a list
NullSpace = Matrix(NullSpace) #
Here NullSpace is a Matrix
print("Null Space : ")
print(NullSpace)
Output:
![]()
Above results means that, null(A)
= { zero vector }
문제 5에서 rank(A) = 12 and nullity(A) = 0가 나왔습니다. 12차원 공간인 R12 안에 12개의 1차독립인 열벡터가 있으므로, 이 12개의 일차독립인 벡터들은 12차원 공간 R12의 basis를 이룬다.
SageMath code:
A = matrix([[1, -1, -4, 0, 7,
-4, 1, 1, 0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
print("Eigenvalues:")
print(A.eigenvalues()) # A의 고윳값 구하기
print("Eigenvectors:")
print(A.eigenvectors_right()) # A의 고유벡터 구하기: (고윳값, [고유벡터], 중복도)
Output:
Eigenvalues:
[-13.54098717868965?, -1.803100416423712?,
1.659630562973108?, 5.518175794358500?, 9.58169696529245?, 11.498872633946612?,
42.78869880210727?, -5.003530737567729? - 10.94894858917260?*I,
-5.003530737567729? + 10.94894858917260?*I, 4.075550773687860? -
11.10898197782554?*I, 4.075550773687860? + 11.10898197782554?*I,
41.15297276419517? + 0.?e-121*I]
Eigenvectors:
[(-13.54098717868965?, [(1, 0.21404851903549?,
3.325614323118192?, 1.29667676080420?, -0.421212655017910?, 0.115338415983921?,
1.042656938067441?, -0.567239907180793?, -1.369740505269219?,
0.1868557555752327?, -1.274517036058226?, 0.50456916304263?)], 1),
(-1.803100416423712?, [(1, 2.591723492951112?, 0.5472394286466899?,
-0.6366561877921963?, 0.2327566510881351?, 0.992749573737378?,
1.291477131532580?, -0.537460532719788?, -0.3307400886294301?,
0.1625010905548922?, -0.6347767630451291?, 1.627745673849294?)], 1),
(1.659630562973108?, [(1, -0.4559357290763599?, 0.1347107016291395?,
0.5247283646836503?, -0.001787932340017962?, -0.6983323966664014?,
-0.3256490514190997?, -0.4078185055457331?, 0.04903579437931110?,
0.013095032980366991?, -0.12098967595632273?, -0.6998042364514651?)], 1),
(5.518175794358500?, [(1, -0.3658057141209298?, -0.1463779671753335?,
-0.5581019776594493?, 0.2334358563110867?, -0.1371238439171233?,
-0.03965346993145629?, -0.4222543784527479?, 0.1660816105941612?, -0.02531030277384912?,
-0.6874844649545678?, 0.5540573097860373?)], 1), (9.58169696529245?, [(1,
-0.5686952468443128?, -0.940793229016212?, -1.033089965236128?,
0.7130594592822325?, 0.9343743878965221?, 0.728720753289262?,
0.11055481756584582?, 0.1029923286054691?, -0.01722274217703538?,
-1.543204511787060?, 0.2894922859987561?)], 1), (11.498872633946612?, [(1,
-0.5970172440872740?, -1.848907020239501?, -1.826386282230717?,
0.660959627192589?, 1.452278540887098?, 1.495957875700040?,
0.5851335446876029?, -0.1901201960079102?, 0.05245091926525836?,
-1.037392135491488?, 0.3375211823764978?)], 1), (42.78869880210727?, [(1,
8.061429178221?, 6.19618285395775?, 120.976780412581?, 1.89975608653693?,
0.5106445512720?, -4.4849928942399?, 9.1831146235389?, 2.50530638615371?,
-37.81016453877047?, -3.1251710653963?, -10.032238438374?)], 1),
(-5.003530737567729? - 10.94894858917260?*I, [(1, -0.16336971293461? -
0.78354106664099?*I, -0.127540839948567? + 6.789550799010967?*I,
0.11054631106813? + 3.09148329711507?*I, 0.157019983430795? +
0.475760864141126?*I, 1.92963894400771? - 2.69353535750101?*I,
2.84203601606613? + 1.12526485649887?*I, -2.966219524395632? +
0.019599589311412?*I, 2.148663985531782? - 1.323644990685522?*I,
0.184980093775860? + 0.2469974143609753?*I, 1.276316903190439? +
1.768268093224660?*I, 0.85640634039517? + 1.21932226868735?*I)], 1),
(-5.003530737567729? + 10.94894858917260?*I, [(1, -0.16336971293461? +
0.78354106664099?*I, -0.127540839948567? - 6.789550799010967?*I,
0.11054631106813? - 3.09148329711507?*I, 0.157019983430795? -
0.475760864141126?*I, 1.92963894400771? + 2.69353535750101?*I,
2.84203601606613? - 1.12526485649887?*I, -2.966219524395632? -
0.019599589311412?*I, 2.148663985531782? + 1.323644990685522?*I,
0.184980093775860? - 0.2469974143609753?*I, 1.276316903190439? -
1.768268093224660?*I, 0.85640634039517? - 1.21932226868735?*I)], 1),
(4.075550773687860? - 11.10898197782554?*I, [(1, -0.188385208586674? +
0.093448020391893?*I, 0.0478907827788662? + 1.176011358723136?*I,
0.123241618919829? + 0.735203834603395?*I, -0.4665237439802774? -
0.2673592731916338?*I, -1.260296813625665? + 1.128170572998405?*I,
0.837945479271127? - 0.1288284877615958?*I, 0.287083336011213? +
1.361765507597295?*I, 0.4866353017801192? - 0.0269974966279578?*I,
0.04132582429721683? + 0.00747934415537053?*I, 0.0591190419091188? +
1.150762932352162?*I, 0.159974762398573? + 0.002746641310582?*I)], 1),
(4.075550773687860? + 11.10898197782554?*I, [(1, -0.188385208586674? -
0.093448020391893?*I, 0.0478907827788662? - 1.176011358723136?*I,
0.123241618919829? - 0.735203834603395?*I, -0.4665237439802774? +
0.2673592731916338?*I, -1.260296813625665? - 1.128170572998405?*I,
0.837945479271127? + 0.1288284877615958?*I, 0.287083336011213? -
1.361765507597295?*I, 0.4866353017801192? + 0.0269974966279578?*I,
0.04132582429721683? - 0.00747934415537053?*I, 0.0591190419091188? -
1.150762932352162?*I, 0.159974762398573? - 0.002746641310582?*I)], 1),
(41.15297276419517?, [(1, -2.4329856517581?, -6.72110091262450?,
-124.403192688883?, -0.34906656538700?, -1.6259249710094?, -2.2173757495278?,
-12.9732084377820?, -0.37888516589757?, -3.37791570157953?, 4.12459747260349?,
9.6673498961823?)], 1)]
Python
code:
import
numpy as np
from
numpy import linalg
from
sympy import *
A
= np.array([[1, -1, -4, 0, 7, -4, 1, 1, 0, -2, -1, 2],
[-1,
0, 0, 1, -1, -1, -1, 1, 0, -6, 1, 1],
[-1,
6, 1, 2, 1, 0, -1, -1, 34, 3, 3, -1],
[1,
-1, -27, 45, -1, 1, -1, 0, 1, -5, -1, 29],
[1,
-2, 1, 0, 1, 4, 0, 0, -1, -2, -1, -1],
[5,
0, 0, -1, -1, 1, 0, 14, -1, 0, -1, -1],
[0,
-1, -8, 1, -1, -1, 3, 0, -5, 6, 0, 0],
[0,
-2, -1, 4, 0, -4, 10, 4, 1, 1, 1, 2],
[-1,
0, 0, 0, -13, 0, -1, 0, -4, -3, -8, 0],
[-1,
-1, -1, 0, 0, 0, -3, 1, 3, 43, -1, 1],
[1,
0, 0, -1, -30, 2, 2, -3, 0, -2, -1, 0],
[0,
-2, 0, -3, -3, 1, -1, -1, 3, 1, 0, 1]])
#The
numpy.linalg.eig function returns a tuple consisting of a vector and an array.
The vector (here w) contains the eigenvalues.
#The
array (here v) contains the corresponding eigenvectors, one eigenvector per
column. The eigenvectors are normalized so their Euclidean norms are 1.
w,
v = linalg.eig(A)
print("Eigenvalues:")
print(w)
print("Eigenvectors:")
print(v)
Output:

Remark: Q: How
to upload a picture directly to I-campus? A: Upload
the picture you want to your computer, then open the folder where the picture
you need is located and just directly drag the picture to the I-campus text
box.
Comment: In week 1, we
learned a lot about the basic principles of linear algebra, as well as methods
for solving various problems using Sage. Through the above codes, I
wanted to compare Sage with Python in terms of capabilities and ease of use. It
seems to me that for solving math problems Sage is more suitable and simpler.
3개의 댓글
이상구(LEE SANGGU)7월 21일 오전 4:26
It is a 100 point abstract of 1st week work of
Math4AI class. Great job!
박진형(2018****59)7월 21일 오후 8:15
Thank you! Thanks to you, I can now properly
attach images. The training content was also informative and helpful.
이상구(LEE SANGGU)7월 22일 오후 9:19
잘 했습니다.
이런 식으로 코드는
Text 로 써서 공유 하시면
... 다른 학생들이 따라서 실습해 보는데 훨씬 도움이 됩니다^^
팁입니다.
[HW2]
선형변환 (Linear
Transformation) 강의 요약 및 정리 + 연습문제 풀기 by 유가이 올렉산드르
[HW2] 선형변환 (Linear
Transformation) 강의 요약 및 정리 + 연습문제 풀기
Solved and Finalized by 유가이 올렉산드르
I. 선형변환(Linear Transformations) 강의 요약 및 정리
1. 행렬변환(matrix
transformation), 선형변환(linear
transformation)
► 입력과 출력이 모두 벡터인 함수를 변환(transformation)이라 한다. Rn에서 Rm으로의 변환 T: Rn => Rm에서 w = T(x)를 벡터 x의 T에 대한 이미지(image), x를 벡터 w의 원상(pre-image)이라 한다.
● Additional definition: A transformation (or
function or mapping) T from Rn to Rm is a rule that
assigns to each vector x in Rn a vector T(x) in Rm. The set Rn is called the
domain of T, and Rm is called the
codomain of T. For x in Rn, the vector T(x) in Rm is called the
image of x (under the action of T).
The set of all images T(x) is called the
range of T.

Figure 1: Domain, codomain, and
range of T: Rn => Rm [2]
► 변환의 특수한 경우로, A가 mxn 행렬이고, TA(x) = Ax, x ∈ Rn인 TA : Rn => Rm를 행렬변환(matrix transformation)이라 한다.
● Additional definition (Matrix
multiplication case): For each x in Rn, T(x) is
computed as Ax, where A is
an mxn matrix. For simplicity, we sometimes
denote such a matrix transformation by x ↦ Ax. Note that, the domain
of T is Rn where A has n columns
and the codomain of T is Rm when each column
of A has m entries.
The range of T is the set of all linear
combinations of the columns of A, because each
image T(x) is of the form Ax.
► Rn에서 Rm으로의 변환 T: Rn => Rm가
임의의 벡터 u, v ∈ Rn와 임의의 스칼라 k에 대하여 다음 두 조건을 만족하면 T를 Rn에서 Rm으로의 선형변환(linear transformation)이라고 한다.
(1) T(u+v)
= T(u) + T(v) for all u, v in
the domain of T;
(2) T(ku) =
kT(u) (k ∈ R) for all scalars c and
all u in the domain of T.
Note: Rn에서 Rn 자신으로의 선형변환 T: Rn => Rn를 Rn 위의 선형연산자(linear operator)라고 한다.
● Remarks:
If T is
a linear transformation, then T(0) = 0 and T(cu+dv)
= cT(u) + dT(v) for all vectors u, v in
the domain of T and all scalars c, d.
Note
that, if a transformation satisfies equation T(cu+dv) = cT(u) +
dT(v) for all c, d,
it must be linear. Repeated application of T(cu+dv) = cT(u) +
dT(v) produces a useful generalization:
T(c1v1 + … + cpvp) = c1T(v1) + … + cpT(vp)
In
engineering and physics, above equation referred to as a superposition
principle.
► Theorem
1: Let T : Rn ↦ Rm be a linear
transformation. Then there exists a unique matrix A such
that
T(x) = Ax for all x in Rn
Here, A is
the mxn matrix whose jth columns
is the vector T(ej), where ej is the jth columns of
the identity matrix Rn:
A = [T(e1) ∙∙∙ T(en)]
The matrix A above is called the standard matrix(표준행렬) for the linear transformation T.
■
● Remark: The
term linear transformation focuses on a property of a mapping, while matrix
transformation describes how such a mapping is implemented.
2. 핵(kernel), 단사, 전사, 전단사, 동형사상(isomorphism)

► Theorem
2.1: Let T: Rn -> Rm be a linear
transformation. Then T is one-to-one if
and only if the equation T(x) = 0 has only
the trivial solution.
► Theorem
2.2: Let T: Rn -> Rm be a linear
transformation, and let A be the standard
matrix for T. Then:
a. T maps Rn onto Rm if and only if the
columns of A span Rm;
b. T is one-to-one if
and only if the columns of A are linearly
independent.
► 선형변환이 단사일 필요충분조건
Rn, Rm이 벡터공간이고 T: Rn -> Rm가 선형변환일 때, T가 단사일 필요충분조건은 ker(T) = {0}이다.
연습문제1: In the following
problem, with T defined by T(x) =
Ax, find a vector x whose image
under T is b,
and determine whether x is unique.

Solution

연습문제2: In the following problem, fill in the missing entries of the matrix, assuming that the equation holds for all values of the variables.

Solution
1. Very fast method:

2. Slower, but more
clear method:


Compare both sides

So, the matrix A is
■.
Comment: I think this to be
a fairly simple, but useful topic in linear algebra. I would especially like to
note its application in the field of image manipulation in Image Processing. I
tried to summarize this topic as I understood it, and also gave several
examples of solving problems manually for a deeper understanding.
참고문헌:
[1] 이상구, 이재화., (2019), “인공지능을 위한 기초수학”, BigBook, pp. 113~120
[2] David
C. Lay, Steven R. Lay, Judi J. McDonald., (2016),“Linear Algebra and its
applications”, Pearson, pp. 63~78
1개의 댓글
김진웅(2015****73)7월 23일 오후 5:04
연습문제
2에서 A를 미지수로 잡을 필요 없이, e1=(1,0,0), e2=(0,1,0), e3=(0,0,1)를 [3x1-2x3, 4x1,
x1-x2+x3]에 각각 대입하여 나온, T(e1)=(3, 4, 0),
T(e2)=(0, 0, -1), T(e3)=(-2, 0, 1)를 열로하는 A를 구해도 될 것 같습니다. (solution 1과 비슷하지만 식으로 정리해 보았습니다.) 좋은 summary와 문제 잘 보았습니다. 감사합니다.
[Final OK by SGLee] Finalized by 나종진, 답변 by 유가이올렉산드르 , 직교대각화가능할 필요충분조건(교재 p.125) 질문 by 나종진
[Final OK by SGLee] Finalized by 나종진,
답변 by 유가이올렉산드르 , 직교대각화가능할 필요충분조건(교재
p.125) 질문 by 나종진
직교대각화가능할 필요충분조건 질문 (교재 p.125)
예제 5번의 풀이방법을 보고 sage를 통해 예제 4번에도 적용하려 합니다.


예제 5번의 풀이에서는 중복되는 고윳값이 있을 경우
1. 중복되는 고유벡터의 정규직교화과정을 통해 직교벡터를 구한
뒤
2. 나머지 고유벡터와 직교벡터를 합쳐 새로운 행렬을 만든 뒤
3. 새로운 행렬에 직교화 과정을 통해 대각행렬을 구해냅니다.
예제 4. 질문입니다. 예제 4번 문제는 이러합니다.

행렬 A의 고윳값을 eigenvectors_right()로 구하면
A=matrix([[0,3,3],[3,0,3],[3,3,0]])
print(A.eigenvectors_right())
실행값
[(6, [(1, 1, 1)], 1), (-3, [(1, 0, -1),(0, 1, -1)], 2)]
이러한 값이 나오게됩니다.
그러면 고윳값은 6, -3이고
고윳값 –3에 대응하는 교유벡터 [(1,0,-1)(0,1,-1)]이 나오게됩니다.
예제 5번의 1번 과정으로
x1=vector([1,0,-1])
x2=vector([0,1,-1])
x3=vector([1,1,1])
B=matrix([x1,x2])
[G, mu] = B.gram_schmidt()
print(G)
실행값
[ 1 0 -1]
[-1/2 1 –1/2]
이러한 값이 나오게 됩니다.
이를 y1, y2로 바꾸어 계산하면
마지막 총 결과값이
A=matrix([[0,3,3],[3,0,3],[3,3,0]])
print(A.eigenvectors_right())
x1=vector([1,0,-1])
x2=vector([0,1,-1])
x3=vector([1,1,1])
B=matrix([x1,x2])
[G, mu] = B.gram_schmidt()
print(G)
y1=vector([1,0,-1])
y2=vector([-1/2,1,-1/2])
C = column_matrix([y1,y2,x3])
P = column_matrix([C.row(i) /
C.row(i).norm() for i in range(0, 3)])
print("P =")
print(P)
print()
print(P.transpose()*A*P)
실행값
[(6, [(1, 1, 1)], 1), (-3, [(1, 0,
-1),(0, 1, -1)], 2)]
[ 1 0 -1]
[-1/2 1 -1/2]
P =
[ 0.6666666666666666 0.0
-0.6666666666666666]
[-0.3333333333333333 0.7071067811865475
-0.3333333333333333]
[ 0.6666666666666666 0.7071067811865475
0.6666666666666666]
[ 0.0 3.5355339059327373
-1.3333333333333335]
[ 3.5355339059327373 2.9999999999999996
-2.1213203435596424]
[-1.3333333333333335 –2.1213203435596424 -2.6666666666666665]
이렇게 나옵니다.
예제의 답과 다르게 나와 어디서 잘못되었는지 궁금합니다.
sage를 통해 어떻게 구하는지 궁금합니다.
Final
A=matrix([[0,3,3],[3,0,3],[3,3,0]])
print(A.eigenvectors_right())
x1=vector([1,0,-1])
x2=vector([0,1,-1])
x3=vector([1,1,1])
B=matrix([x1,x2])
[G, mu] = B.gram_schmidt()
print(G)
y1=vector([1,0,-1])
y2=vector([-1/2,1,-1/2])
C = column_matrix([y1,y2,x3])
P = column_matrix([C.column(i) / C.column(i).norm() for i in range(0, 3)])
print("P =")
print(P)
print()
print(P.transpose()*A*P)
실행값
[(6, [(1, 1, 1)], 1), (-3,
[(1, 0, -1),(0, 1, -1)], 2)]
[ 1 0 -1]
[-1/2 1 -1/2]
P =
[ 1/2*sqrt(2) -1/3*sqrt(3/2) 1/3*sqrt(3)]
[
0 2/3*sqrt(3/2) 1/3*sqrt(3)]
[ -1/2*sqrt(2) -1/3*sqrt(3/2) 1/3*sqrt(3)]
()
[-3 0
0]
[ 0 -3 0]
[ 0 0
6]
교재와 같은 값이 나왔다.
또한
C = matrix([y1,y2,x3])
P = matrix([C.row(i) / C.row(i).norm() for i in range(0, 3)])
print("P =")
print(P.transpose())
이렇게 받아도 같은 결과가 나온다.
한쪽에서는 column으로 계산하고 그 다음에는 row 로 계산해서 다른 결과값이 나왔었다.
학우분과 소통하면서 문제를 푸니 내가 보지 못한 부분을 캐치해주셔서 너무 고마웠다.
유가이올렉산드르(2018****33)7월 23일 오후 7:55
12번째 라인에서 C.row(i) => C.column(i)로 수정하시면 될 것 같습니다.
A=matrix([[0,3,3], [3,0,3], [3,3,0]]) print(A.eigenvectors_right()) print
x1=vector([1,0,-1]) x2=vector([0,1,-1]) x3=vector([1,1,1]) B=matrix([x1, x2])
[G, mu] = B.gram_schmidt() print(G) print y1=vector([1,0,-1]) y2=vector([-1/2,
1, -1/2]) C = column_matrix([y1,y2,x3]) P = column_matrix([C.column(i) /
C.column(i).norm() for i in range(0, 3)]) print("P =") print(P) print
print(P.transpose()*A*P)
유가이올렉산드르(2018****33)7월 23일 오후 8:26
코드를
실행해봤는데
예제의
답과 같은 답이 나옵니다.
나종진(2017****17)7월 23일 오후 8:52 감사합니다. 해결되었습니다.
이상구(LEE SANGGU)7월 23일 오후 9:38 Good job^^☆☆
[HW2] 고윳값(eigenvalue), 고유벡터(eigenvector), 대각화(Diagonalization) 강의 요약 및 정리 + 연습문제 풀기 by 유가이 올렉산드르
Solved and Finalized by 유가이 올렉산드르
II. 고윳값(Eigenvalue)과 고유벡터(Eigenvector), 대각화(Diagonalization)
1. 고윳값(eigenvalue)과 고유벡터(eigenvector)
► A를 n차의 정사각행렬이라 하자. 0 아닌 벡터 x∈Rn가 적당한 스칼라 λ에 대하 여 다음을 만족하면 λ를 A의 고윳값(eigenvalue)이라 하고, x를 λ에 대응하는 A 의 고유벡터(eigenvector)라고 한다.
Ax = λx
● Remark: x ∈ Rn가 고윳값 λ에 대응하는 A의 고유벡터이면 영 아닌 임의의 스칼라 k에 대하여 kx도 λ에 대응하는 A의 고유벡터가 된다.
Ax = λx => A(kx) = k (Ax) = k(λx) =
λ(kx)
● Alternative
definition: 행렬 A를 선형변환으로 봤을 때, 선형변환 A에 의한 변환 결과가 자기 자신의 상수배가 되는 0이 아닌 벡터를 고유벡터(eigenvector)라 하고 이 상수배 값을 고유값(eigenvalue)라 한다. 즉, n
x n 정방행렬(고유값, 고유벡터는 정방행렬에 대해서만 정의된다) A에 대해 Av = λv를 만족하는 0이 아닌 열벡터 v를 고유벡터, 상수 λ를 고유값이라 정의한다.

여기 λ는 행렬 A의 고유값, v는 행렬 A의 λ에 대한 고유벡터이다.
즉, 고유값과 고유벡터는 행렬에 따라 정의되는 값으로서 어떤 행렬은 이러한 고유값 - 고유벡터가 아에 존재하지 않을수도 있고 어떤 행렬은 하나만 존재하거나 또는 최대 n개까지 존재할 수 있다.
►Theorem
1: The
eigenvalues of a triangular matrix are the entries on its main diagonal.

The scalar λ is
an eigenvalue of A if and only if the equation (A
- λI)x
= 0 has
a nontrivial solution, that is, if and only if the equation has a free
variable. Because of the zero entries in A – λI, it is easy to see
that (A - λI)x
= 0 has
a free variable if and only if at least one of the entries on the diagonal
of A – λI is
zero. This happen if and only if λ equals one of the entries a11, a22, a33 in A.
■
►
Theorem 2: If v1,
… ,vr are eigenvectors
that correspond to distinct eigenvalues λ1,
… , λr of
an nxn matrix A, then the set {v1,
… ,vr} is
linearly independent.
PROOF Suppose {v1,
… ,vr} is
linearly dependent. Since v1 is
nonzero, one of the vectors in the set is a linear combination of the preceding
vectors. Let p be the least index such that vp+1 is
a linear combination of the preceding (linearly independent) vectors. Then
there exist scalars c1,
… ,cp such that

Since {v1,
… ,vp} is
linearly independent, the weights in (7) are all zero. But
none of the factors λ1 – λp+1 are zero, because
the eigenvalues are distinct. Hence ci =
0 for I
= 1, … ,p. But then (5) says that vp+1 =
0,
which is impossible. Hence {v1,
… ,vr} cannot
be linearly dependent and therefore must be linearly independent. ■
● Remark(The
characteristic equation): The scalar equation det(A- λI) = 0 is called the
characteristic equation of A. Note that, a scalar λ is
and eigenvalue of an nxn matrix A if
and only if λ satisfies the characteristic
equation det(A - λI)
= 0.
2. 닮음 행렬(similar matrix)과 행렬의 대각화(Matrix
Diagonalization)
► 정사각행렬 A, B에 대하여 다음을 만족하는 가역행렬 P가 존재할 때 B는 A와 닮은(similar) 행렬이라고 한다.
B = P-1AP
이때, B
~ A라 쓴다.
(모든 행렬은 주대각선 성분이 고윳값인 삼각행렬과 닮음이고, 삼각행렬의 특성방정식은 쉽 게 구할 수 있으며) 닮음행렬들은 행렬식이 같기 때문에, 특성방정식, 고윳값이 같다는 것 을 아주 쉽게 보일 수 있다.
►
Theorem 3: If
nxn matrices A and B are
similar, then they have the same characteristic polynomial and hence the same
eigenvalues (with the same multiplicities).

●
Important remark:

► 대각화가능한(diagonalizable) 행렬
A가 어떤 대각선행렬과 닮은 행렬일 때, 즉 적당한 가역행렬 P가 존재하여 P-1AP가 대각선행렬일 때 A를 대각화가능한(diagonalizable) 행렬이라 하며, 이때 행렬 P를 A를 대각화하는(diagonalizing) 행렬이라고 한다.
► 대각화가능할 필요충분조건
n차의 정사각행렬 A가 대각화가능할 필요충분조건은 A가 n개의 일차독립인 고유벡터를 갖는 것읻다. 이때, A는 자신의 고윳값 λ1,
… , λn을 주대각선성분으로 갖는 대각선행렬 D와 닮은 행렬이다.
►
Theorem 4 (The Diagonalization Theorem): An nxn matrix A is
diagonalizable if and only if A has n linearly
independent eigenvectors. In fact, A = PDP-1,
with D a diagonal matrix, if and only if the columns
of P are n linearly independent eigenvectors of A.
In this case, the diagonal entries of D are eigenvalues
of A that correspond, respectively, to the eigenvectors
in P.
● Remark: This
means, A is diagonalizable if and only if there are
enough eigenvectors to form a basis of Rn.
We call such a basis an eigenvector basis of Rn.


► A를 대각화하는 행렬 P를 구하는 과정
1단계: A의 n개의 일차독립인 고유벡터 p(1),
p(2), … ,p(n)을 구한다.
2 단계: p(1),
p(2), … , p(n)을 열벡터로 갖는 행렬 P를 만든다.
3단계: 이 P가 A를 대각화하는 행렬이고 P-1AP는 A의 대응하는 고윳값 λ1,
… , λn을 순서대로 주 대각선 성분으로 갖는 대각선행렬 D이다.
D = diag(λ1,
… , λn)
● Summarizing all of the
above: Step
1: Find the eigenvalues of A; Step 2: Find
three linearly independent eigenvectors of A; Step
3: Construct P from the vectors in Step
2; Step 4: Construct D from the
corresponding eigenvalues.
►
Theorem 5: An nxn matrix
with n distinct eigenvalues is diagonalizable.
PROOF Let v1,
… ,vn be eigenvectors
corresponding to the n distinct eigenvalues of a
matrix A. Then {v1,
… ,vn} is
linearly independent. Hence, A is diagonalizable
by Theorem 4 above. ■
►
Theorem 6 (Matrices whose eigenvalues are not distinct):

3. 직교대각화 (orthogonally diagonalizing)
► 직교행렬(real orthogonal matrix, ATA = I, A-1 = AT): 정사각행렬 A에 대하여 A-1 = AT이면 A를 직교행렬(real orthogonal matrix)이라고 한다.
► 행렬 A가 직교행렬이면 다음을 만족한다.
(1) 행렬 A의 행벡터들은 서로 직교이며, 정규벡터이다.
(행들이 정규직교벡터이다)
(2) 행렬 A의 열벡터들은 서로 직교이며, 정규벡터이다.
(열들이 정규직교벡터이다)
(3) A는 가역행렬이다. (A-1 =
AT,
ATA
= I)
(4) ||Ax||
= ||x||를 만족한다.
(즉, 길이를 보존한다)
<Ax, Ax> = (Ax)TAx
= xTATAx
= <x, x>
●
Remark: 직교행렬의 역행렬은 단지 전치행렬은 쓰기만 해도 구할 수 있다. (A-1 =
AT)
►Additional definition(Orthogonal
diagonalization): An nxn matrix A is said to
be orthogonally diagonalizable if there are an orthogonal matrix P (with P-1 =
PT and P has
orthogonal columns) and a diagonal D such that A
= PDPT =
PDP-1.
●
Remark: Such
a diagonalization requires n linearly independent and
orthonormal eigenvectors. If A is orthogonally
diagonalizable, then AT =
(PDPT)T =
(PT)TDTPT =
PDPT =
A,
i.e. A is symmetric.
►
Theorem 7: An nxn matrix A is
orthogonally diagonalizable if and only if A is
symmetric matrix.
►
Theorem 8 (The Spectral Theorem for Symmetric Matrices): An nxn symmetric
matrix A has the following properties:
(1) A
has n real eigenvalues, counting multiplicities.
(2) The
dimension of the eigenspace for each eigenvalue λ equals
the multiplicity of λ as a root of the characteristic
equation.
(3) The
eigenspace are mutually orthogonal, in the sense that eigenvectors
corresponding to different eigenvalues are orthogonal.
(4) A
is orthogonally diagonalizable.
4. 고윳값 분해(eigen-decomposition)
► In linear
algebra, eigen-decomposition or sometimes spectral
decomposition is the factorization of a matrix into a canonical form,
whereby the matrix is represented in terms of its eigenvalues and
eigenvectors. Only diagonalizable matrices can be factorized in this
way.
►
Eigendecomposition of a matrix: Let A be a
square n×n matrix with n linearly independent
eigenvectors qi (where i
= 1, ... ,n). Then A can be factorized as
A = QΛQ-1 (same
as A = PDP-1,
just here different notations are used)
where Q is
the square n × n matrix whose ith
column is the eigenvector qi of A,
and Λ is the diagonal matrix whose diagonal elements
are the corresponding eigenvalues, Λii =
λi. Note that only
diagonalizable matrices can be factorized in this way. For example, the
defective matrix ([[1, 1], [0, 1]]) cannot be diagonalized.
The n eigenvectors qi are
usually normalized, but they need not be. A non-normalized set of n eigenvectors, vi can
also be used as the columns of Q. That can be understood by
noting that the magnitude of the eigenvectors in Q gets
canceled in the decomposition by the presence of Q−1.
The decomposition
can be determined from the fundamental property of eigenvectors:
Av = λv
AQ = QΛ
A = QΛQ-1
► det(CD)
= det(D)det(C)이고 tr(CD) = tr(DC), P-1AP
= D ó A
= PDP-1


연습문제 1: Find a basis
for the eigenspace corresponding to each listed eigenvalue.

Solution

연습문제 2: Find the
characteristic polynomial and the eigenvalues of the following matrix.

Solution

연습문제 3: Diagonalize
the following matrix, if possible.

Solution



Additional
Example Problem: Orthogonally diagonalize the following
matrix.

Solution



Comment: I
think eigenvalue and eigenvector is one of the fundamental topics of linear
algebra. Think of eigenvalues and eigenvectors as providing summary of a large
matrix (We can use in areas such as Diagonalization SVD etc.). Eigenvectors and
eigenvalues are used to reduce noise in data. They can help us improve
efficiency in computationally intensive tasks. They also eliminate features
that have a strong correlation between them and also help in reducing
over-fitting. I tried to summarize this important topics, and gave several
examples of solving problems manually for a deeper understanding.
참고문헌:
[1] 이상구, 이재화., (2019), “인공지능을 위한 기초수학”,
BigBook, pp. 113~120
[2] David
C. Lay, Steven R. Lay, Judi J. McDonald., (2016),“Linear Algebra and its
applications”, Pearson, pp. 63~78
[3] Darkpgmr.,
(2013), “고유값과 고유벡터 (eigenvalue
& eigenvector)”, Tistory,
URL: https://darkpgmr.tistory.com/105
[4] Wikipedia.,
(2020), “Eigendecomposition of a matrix”, Wikimedia Foundation,
URL: https://en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix
2개의 댓글
이상구(LEE SANGGU)7월 25일 오전 3:27
Good job^^
임성규(2015****08)7월 26일 오후 4:23
Alternative definition: 행렬 A를 선형변환으로 봤을 때, 선형변환
A에 의한 변환 결과가 자기 자신의 상수배가 되는 0이 아닌 벡터를 고유벡터(eigenvector)라 하고 이 상수배 값을 고유값(eigenvalue)라 한다. 즉, n x n 정방행렬(고유값,
고유벡터는
정방행렬에
대해서만
정의된다) A에 대해 Av = λv를 만족하는 0이 아닌 열벡터 v를 고유벡터, 상수 λ를 고유값이라 정의한다. 여기 λ는 행렬 A의 고유값, v는 행렬 A의 λ에 대한 고유벡터이다. 즉, 고유값과 고유벡터는 행렬에 따라 정의되는 값으로서 어떤 행렬은 이러한 고유값 - 고유벡터가 아에 존재하지 않을수도 있고 어떤 행렬은 하나만 존재하거나 또는 최대 n개까지 존재할 수 있다. -->고유값과 고유벡터를 선형변환의 관점에서 보고 해석한 것이 새로웠고 앞장에서 선형변환을 배웠었기에 좀 더 와닿은 관점이었습니다. -->The interpretation of eigenvalues and
eigenvectors from the perspective of linear transformation was new, and I
learned the linear transformation in the previous chapter, so it was a more
touching point of view.
[Final
ok by SGLee] [HW2] 특이값 분해(Singular
Value Decomposition, SVD) 강의 요약 및 정리 + 연습문제 풀기 by 유가이 올렉산드르
Solved and Finalized by 유가이 올렉산드르
[Final ok by SGLee] 특이값 분해(Singular Value Decomposition, SVD)
III. SVD (특이값 분해, Singular Value Decomposition)
1. 특이값 분해
► Brief about SVD [3], [4]: 특이값 분해(Singular Value Decomposition, SVD)는 행렬을 특정한 세 개의 행렬의 곱으로 표현 구조로 분해하는 방식으로, 신호 처리와 통계학 등의 분야 에서 자주 사용된다. 특이값 분해는 행렬의 스펙트럼 이론을 임의의 직사각행렬에 대해 일반화한 것으로 볼 수 있다. 스펙트럼 이론을 이용하면 직교 정사각행렬의 고윳값에 대응하는 고유벡터를 이용하여 행렬의 대각화가 가능하다. 을 기저로 하여 대각행렬로 분해할 수 있다. (대칭행렬인 AAT 가 항상 직교대각화
가능하므로 )
실수공간에서 임의의 mxn 행렬 A에 대한 특이값분해(SVD)는 다음과 같이 정의된다.
A = UΣVT
U: mxm 직교행렬 (AAT = U(ΣΣT)UT)
V: nxn 직교행렬 (ATA = V(ΣTΣ)VT)
Σ: mxm 직사각 대각행렬
U는 AAT를 고유값분해(eigendecomposition)해서 얻어진 직교행렬(orthogonal matrix)로 U의 열벡터들을 A의 left singular
vector라 부른다. 또한 V는 ATA를 고유값분해해서 얻어진 직교행렬로서 V 의 열벡터들을 A의 right singular
vector라 부른다. left, right가 상당히 햇갈리는데 그냥 Σ의 왼쪽에 있는 U가 left singular 벡터, 오른쪽에 있는 V가 right
singular 벡터들이라고 생각하면 된다.
마지막으로, Σ는 AAT, ATA를 고유값분해해서 나오는 고유값(eigenvalue)들의 양의 square root를 대각원소로 하는 mxn 직사각 대각행렬로 그 대각원소들을 A의 특이값(singular value)이라 부른다. U, V가 직교행렬(orthogonal matrix)이라 함은 UUT = VVT = Identity matrix (I or E), U-1=UT, V-1=VT임도 기억해야 된다.
● Remark (Singular Values): The
singular values of matrix A are the square roots of the
eigenvalues of ATA,
denoted by σ1,
… ,σn and they are
always arranged in decreasing order. That is, σ1 ≥
σ2 ≥ ∙∙∙ ≥ σn ,
here σ1 =
squareroot(λ1), σ1 =
squareroot(λ2) and
so on.
►
Theorem 1: Suppose {v1,
… ,vn} is
an orthonormal basis of Rn consisting
of eigenvectors of ATA,
arranged so that the corresponding eigenvalues of ATA satisfy λ1 ≥
∙∙∙ ≥ λn , and
suppose A has r nonzero
singular values. Then,
(1) {Av1,
… ,Avr} is
an orthogonal basis for Col(A).
(2) rank
A = r
PROOF Since vi and λjvj are
orthogonal for i ≠ j,
(Avi)T (Avj)
= viT ATAvj =
viT (λjvj)
= 0
Thus {Av1,
… ,Avn} is
an orthogonal set. Furthermore, since the lengths of the vectors Av1,
… ,Avn are the singular
values of A, and since there are r nonzero
singular values, Avi ≠
0 if
and only if 1 ≤ i ≤ r. So, Av1,
… ,Avn are linearly
independent vectors, and they are in Col A. Finally, for
any y in Col A, we can say
that, y = Ax, and we can write x = c1v1 +
∙∙∙ + cnvn,
and
y = Ax = c1Av1 + ∙∙∙ + crAvr + cr+1Avr+1 + ∙∙∙ +cnAvn = c1A1 + ∙∙∙ + crAvr + 0 + ∙∙∙ + 0
Thus y is
in Span {Av1, … ,Avn},
which shows that {Av1,
… ,Avn} is
an (orthogonal) basis for Col A. Hence rank A =
dim Col A = r. ■
●
SVD Remark: The decomposition of A involves
an mxn “diagonal” matrix Σ of the form

►
Theorem 2: Let A be
an mxn matrix with rank r. Then
there exists an mxn matrix Σ for which the diagonal
entries in D are the first r singular
values of A, σ1 ≥
σ2 ≥ ∙∙∙ ≥ σr >
0,
and there exist an mxm orthogonal matrix U and
an nxn orthogonal matrix V such
that
A = U ΣVT

● 특이값 분해의 목적 [4]:
특이값 분해의 공식을 다시 풀어 써보자면 다음과 같다.

여기서 u1v1T 등은 mxn 행렬이 된다. 또 u와 v는 정규화된 벡터이기 때문에 u1v1T 내의 성분의 값은 -1에서 1사이의 값을 가진다.
따라서, σ1u1v1T라는 부분만을 놓고 보면, 이 행렬의 크기는 σ1의 값에 의해 정해지게 된다.
즉, 우리는 SVD라는 방법을 이용해 A라는 임의의 행렬을 여러 개의 A행렬과 동일한 크기를 갖는 여러 개의 행렬로 분해해서 생각할 수 있는데, 분해된 각 행렬의 원소의 값의 크기는 σ의 값의 크기에 의해 결정된다.
다시 말하면, SVD를 이용해 임의의 행렬 A를 정보량에 따라 여러 layer로 쪼개서 생각할 수 있게 해준다.
● 특이값 분해의 기하학적 의미 / Geometric meaning of
SVD [3]:
행렬을 x' = Ax와 같이 좌표공간에서의 선형변환으로 봤을 때 직교행렬(orthogonal matrix)의 기하학적 의미는 회전변환(rotation transformation) 또는 반전된(reflected) 회전변환, 대각행렬(diagonal
maxtrix)의 기하학적 의미는 각 좌표성분으로의 스케일변환(scale
transformation)이다.
행렬 R이 직교행렬(orthogonal
matrix)이라면 RRT =
I이다. 따라서 det(RRT)
= det(R)det(RT)
= det(R)2 =
1이므로 det(R)는 항상 +1, 또는 -1이다. 만일 det(R)=1라면 이 직교행렬은 회전변환을 나타내고 det(R)=-1라면 뒤집혀진(reflected) 회전변환을 나타낸다.
따라서 식 A = UΣVT에서 U, V는 직교행렬, Σ는 대각행렬이므로 Ax는 x를 먼저 VT에 의해 회전시킨 후 Σ로 스케일을 변화시키고 다시 U로 회전시키는 것임을 알 수 있다.

즉, 행렬의 특이값(singular
value)이란 이 행렬로 표현되는 선형변환의 스케일 변환을 나타내는 값으로 해석할 수 있다.
고유값분해(eigendecomposition)에서 나오는 고유값(eigenvalue)과 비교해 보면 고유값은 변환에 의해 불변인 방향벡터(-> 고유벡터)에 대한 스케일 factor이고, 특이값은 변환 자체의 스케일 factor로 볼 수 있다.
즉, mxn 행렬 A는 n차원 공간에서 m 차원 공간으로의 선형변환이다. n차원 공간에 있는 원, 구 등과 같이 원형으로 된 도형을 A에 의해 변환시키면 먼저 VT에 의해서는 회전만 일어나므로 도형의 형태는 변하지 않는다. 그런데 Σ에 의해서는 특이값의 크기에 따라서 원이 타원이 되거나 구가 럭비공이 되는 것과 같은 식의 형태변환이 일어난다 (n이 2차원인 원의 경우 첫번째 특이값 σ1은 변환된 타원의 주축의 길이, 두번째 특이값 σ2는 단축의 길이에 대응된다). 이후 U에 의한 변환도 회전변환이므로 도형의 형태에는 영향을 미치지 못한다. 만일 m>n이라면 0을 덧붙여서 차원을 확장한 후에 U로 회전을 시키는 것이고 m<n이라면 일부 차원을 없애버리고(일종의 투영) 회전을 시키는 셈이다. 결국 선형변환 A에 의한 도형의 변환결과는 형태적으로 보면 오로지 A의 특이값(singular
value)들에 의해서만 결정된다는 것을 알 수 있다.
● 행렬근사 (데이터 압축)
[3]
아래와 같이 mxn 행렬 A 가 있고, 여기는 m > n이다.
s = Singular
value 개수이고, r = Singular
value 중 0이 아닌 것들의 개수라고 할 때 행렬 A를 SVD로 분해하는 것을 Full
SVD라고 한다.

<Full SVD>
Σ 행렬에서 대각파트가 아닌 0으로 구성된 부분을 없애고 U에서는 이에 대응되는 열벡터들을 제거한 형태를 Thin
SVD라고 한다.

<Thin SVD>
비대각 원소뿐 아니라 0인 Singular
value들까지 모두 제거한 형태를 Compact
SVD라고 한다.

<Compact SVD>
비대각 원소, 0인 Singular Value뿐 아니라 0이 아닌 Singular value 까지 제거한 형태를 Truncated SVD라고 한다.

<Truncated SVD>
* Truncated
SVD는 데이터 압축, 노이즈 제거 등에 활용될 수 있다.
●
Remark: 이미지 프로세싱에 관심이 있다면 이상구 교수님의 선형 대수학 연구실에서 제공한 아주 자세하고 다양한 Step-by-step 코딩 예제가 많은 “Matrix Decomposition and Image
Processing via MATHEMATICA”라는 논문을 읽는 것이 좋다고 생각한다 (특히 Image Processing
using SVD 부분). 여기에 MATHEMATICA라는 프로그램이 코딩에 사용되었지만 설명은 매우 상세하고 흥미롭다.
URL: http://matrix.skku.ac.kr/sglee/03-Note/IP/ImageProcessing.htm
2. 일반화된 역행렬 (pseudo-inverse,
Moore-Penrose Generalized Inverse)
►선형대수학에서, 무어-펜로즈 유사역행렬(Moore–Penrose pseudoinverse matrix)은 모든 모양의 행렬에 대하여 정의되는 연산이며, 가역 행렬의 역행렬 연산을 일반화한다. 특잇값 분해를 통해 계산할 수 있다.

►
Pseudo-inverse (Moore-Penrose Generalized Inverse)

►
Additional definition [2.2]:

►
Basic Properties [2.2]:

► Full column rank를 갖는 mxn 행렬의 pseudo-inverse
행렬 A가 (n개의 열이 모두 일차독립인) full column rank를 갖는 mxn 행렬이면, Ax=b의 양변에 AT를 곱해준 (ATA)x = ATb를 정규방정식(normal equation)이라하고, 이 정규방정식은 언제나 유일해 x = (ATA)-1ATb를 갖는다. 이 때 A+ = (ATA)-1AT를 A의 pseudo-inverse (Moore-Penrose Generalized Inverse의 특수한 경우)라고 한다.
►
Additional definition:

3. 최소제곱해 (least square solution)
► A가 mxn 행렬이고, b는 Rn의 임의의 벡터이면, x = A+b는 (최소의 에러를 갖는) Ax = b의 최소제곱해이다.
►
Alternative definition (Least-Square Solution): Given the
equation Ax = b, use the pseudoinverse of A to
define
x̂ = A+ b
= Vr D-1 UrT b
Then,
from the Reduced SVD equation above,
Ax̂ = (Ur D
VrT)(Vr D-1 UrT b)
= Ur D
D-1 UrT b
= Ur UrT b
* Remark: VrT Vr =
Ir .
Note that, Ur UrT b is
the orthogonal projection b̂ of b onto Col
A. Thus x̂ is a least-square solution of Ax
= b. In fact, this x̂ has the smallest length
among all least-square solutions of Ax = b.
연습문제 1: Find the
singular values of the following matrix.

Solution
연습문제2: Find an SVD of
the following matrix.

Solution
Consider the
following matrix:

Determine the
transpose of A and then multiply it with A as
follows:

Then, the
matrix AT A is
gives as,

Find the
eigenvalues of AT A by
using of det(ATA
- λI) = 0.

Simplify the
left side of the equation for λ.
λ2 -
13λ + 40 – 4 = 0
λ2 -
13 λ + 36 = 0
(λ - 4)( λ - 9) = 0
λ = 9; 4.
Hence, the
eigenvalues of AT A are 9 and 4.
Determine the
eigenvectors corresponding to eigenvalues λ1 =
9 and λ2 =
4.
For λ1 =
9,
the eigen vector is given as,

Row reduce the
augmented matrix for AT A
– 9I = 0.

The
corresponding equation is given as,
-x1 +
2x2 =
0
Here, x2 is
a free variable, so let’s take x2 =
1,
and x2 =
2.

For λ2 =
4,
the eigenvector is given as,

Row reduce the
augmented matrix for AT A
– 9I = 0.

The
corresponding equation is given as,
4x1 +
2x2 = 0.
Here, x2 is
a free variable, so let’s take x2 =
1,
and x1 =
- 1/2.

Their
corresponding unit eigenvectors are:

These unit
vectors form the columns of matrix V:

The singular
values of A are square root of eigenvalues of
matrix A:
and 
Therefore, the
singular values of A are 3 and 2.
Here, the
nonzero singular values are the diagonal entries of matrix D,
that is:

The matrix Σ is the same size as A,
with D in its upper left corner and with 0’s elsewhere.
Thus, the matrix
is:

Now,
compute u1 and u2 using u1 =
(1 / σ1)
(Av1) and u2 = (1
/ σ2)
(Av2).
and 
Finally,
as {u1,
u2} is
a basis for R2,
set U = [u1,
u2],
then take Σ and VT from
above and write A as UΣVT.

Therefore, the
singular value decomposition of matrix A is give as,
A = UΣVT
.
■
Comment: SVD
is one of the key topics in linear algebra. The Singular Value Decomposition
(SVD) provides another way to factorize a matrix, into singular vectors and
singular values. The SVD allows us to discover some of the same kind of
information as the eigen-decomposition. However, the SVD is more generally
applicable. The singular value decomposition (SVD) has numerous applications in
statistics, machine learning, image processing and computer science. I tried to
give a manual solution of two tasks to show the process of calculating SVD. I
also briefly reviewed information from several sources to show how wide the
scope of application of SVD is.
참고 문헌:
Theory:
[1] 이상구, 이재화., (2019), “인공지능을 위한 기초수학”,
BigBook, pp. 113~120
[2] David
C. Lay, Steven R. Lay, Judi J. McDonald., (2016),“Linear Algebra and its
applications”, Pearson, pp. 63~78
[2.2] Wikipedia.,
(2020), “Moore–Penrose inverse”, Wikimedia Foundation,
URL: https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse
I would like to
recommend the following articles for further reading:
Theory;
image processing + statistics using SVD:
[3] Darkpgmr.,
(2013), “특이값 분해(Singular
Value Decomposition, SVD)의 활용”,
Tistory,
URL: https://darkpgmr.tistory.com/106
Lots of visual examples of SVD
calculation:
[4] D'Angelo Yeo.,
(2019), “특이값 분해(SVD)”. Github,
URL: https://angeloyeo.github.io/2019/08/01/SVD.html
Image Processing using SVD:
[5] 이상구, 양정모, 김덕선.,
(N/D), “Matrix Decomposition and Image Processing via MATHEMATICA”, SKKU Linear Algebra Lab,
URL: http://matrix.skku.ac.kr/sglee/03-Note/IP/ImageProcessing.htm
1개의 댓글
이상구(LEE SANGGU)7월 27일 오후 8:04
Very Good^^ Your work is always something
special^^ Superb~~
[HW3]
함수(function), 극한(limit),
도함수(derivative)와 미분(differentiation)
강의 요약 및 정리 + 연습문제 풀기 + 코딩 실습 by 유가이 올렉산드르
Solved and Finalized by 유가이 올렉산드르
I. 함수 [1], [2], [3], [4], [5], [6]
►
Definition: A function(함수)
is a correspondence between a first set, called the domain, and a second set,
called the range, such that each member of the domain corresponds to exactly
one member of the range.
●
Example: A 와 B 가 집합이라고 하자. A 로부터 B 로의 함수 f 는 A 의 원소 각각에 B 의 원소를 단 하나만 대응시킨 것이다. 함수는 f(
a ) = b 와 같이 적고 이것은 원소 a 에 함수 f 에 의해 대응된 원소가 b 임을 나타낸다.

►
Theorem 1: 두 집합 X와 Y의 원소 사이에 관계 f가 아래를 만족하면 함수라고 한다.
1. ∀(for all) x ∈ X에 대하여 y = f(x)인 y ∈Y가 반드시 존재한다.
2. x1,
x2 ∈ X일 때, x1 =
x2이면 f(x1)
= f(x2)이다.
►
Theorem 2 (집합 X에서 집합 Y로의 함수 f를: X → Y로 적는다.):
f :
X → Y에서 X 를 f 의 정의역(domain), Y를 f의 공역(codomain)이라고 한다. f (x) = y 라면 y 는 x 의 상(image)로 x는 y의 원상(preimage)로 부른다. X 의 모든 원소에 대응되는 모든 상들의 집합을 f의 치역(range) 또는 상(image)이다. 정의역과 공역이 같고 정의역의 모든 원소 x에 대하여 f(x) = g(x)인 두 함수는 f, g는 서로 같다 (f
= g).
f :
X → Y 에서 S⊂X 일 때, S의 상은 f(S)
= {f(s) | s∈S} 로 적는데 이 집합은 Y의 부분집합이다. 따라서, 치역은 f(X) 로 적는다.

●
Remark (basic function notation): «f(x) = …» is the
classic way to writing a function. But there are also many other ways to denote
a function.
Any
function has three main parts:
1. The
input
2. The
relationship
3. The
output
The most common
name of a function is “f”, but we can have other names like “g”,
“e” etc.
But, let’s use “f”:

What goes into
the function is put inside parentheses () after the name of the function:
So, f(x) shows us the function is called “f”,
and “g” goes in
And we usually
see what a function does with the input:
f(x)
= x2 shows us that
function “f” takes “x” and square it.
For example, in
above function f(x) = x2,
“an input of 3 => becomes an output of 9”.
In fact, we can write it as “f(3) = 9”.
► 함수의 가장 많이 사용하는 것이 그래프이다. 그래프(graph)는 아래와 같은 순서쌍으로 이루어진 집합이다. 아래 집합을 직교좌표축(cartesian
coordinate)에 나타내면 함수를 쉽게 다룰 수 있다.
G = {(x, f(x)) | x ∈ D}
► Theorem 3:
f: X→Y에서
∀(for all) x1,
x2 ∈ X, f(x1)
= f(x2) ⇒ x1 =
x2이면 f는 단사 함수(one-to-one 또는 injection)이다.
∀(for all) y ∈ Y , ∃(there is exist (at least one)) x ∈ X (f (x) = y) 라면, 즉, f(X)
= Y이면 f는 전사 함수(onto 또는 surjection)이다.
전사이고 단사이면 전단사 함수(일대일 대응:
one-to-one correspondence 또는 bijection)이다.
►
Theorem 4:
f: X→Y가 전단사 함수일 때, f(x)
= y인 y에 x를 대응시키는 함수를 역함수라고 하고 f-1로 적는다.
f-1 :
Y → X (f-1(y)
= x)
►
Theorem 5:
f: X→Y 에서 ∀(for all) x1 ,
x2 ∈ X , x1 <
x2 ⇒ f(x1) ≤ f(x2) 이면 증가함수(increasing function) 또는 단조(monotonic)증가함수로 f(x1)
< f(x2)이면 엄격한 증가함수(strictly
insreasing function)으로 부른다.
마찬가지로 f: X→Y에서 ∀(for
all) x1,
x2 ∈ X , x1 <
x2 ⇒ f(x1) ≥ f(x2)이면 감소함수(decreasing function) 또는 단조(monotonic)감소함수로 f(x1)
> f(x2)이면 엄격한 감소함수(strictly
desreasing function)으로 부른다.
●
Remark(The Vertical Line Test): A curve in the xy-plane is
the graph of a function of x ó (if
and only if) no vertical line intersects the curve more than once.

●
Remark: There
are various types of functions in mathematics. Below are brief
explanations of the main ones.
Constant
Function: Let A and B be
any two non–empty sets, then a function f from A to B is
called a constant function if and only if the range of f is
a singleton.
Algebraic
Function: A
function defined by an algebraic expression is called an algebraic function.
e.g. f(x)=x2 +
3x + 6
Polynomial
Function: A
function of the form P(x)=amxn +
an-1xn-1 + ⋯ +
a1x + a0 where
‘n’ is a positive integer and an,
an–1 , ⋯ ,
a1, a0 are
real numbers is called a polynomial function of degree n.
Linear
Function: A
polynomial function with degree ‘t’ is called a linear function. The
most general form of a linear function is f(x)=ax + b
Quadratic
Function: A
polynomial function with degree ‘2’ is called a quadratic
function. The most general form of a quadratic equation is f(x)=ax2 +
bx + c
Cubic
Function: A
polynomial function with degree ‘3’ is called a cubic function. The most
general form of a cubic function is f(x)=ax3+bx2+cx+d
Identity
Function: Let f:
A→B be
a function then f is called an identity function if f(x) = x, ∀(for all) x ∈ A.
Rational
Function: A
function R(x) defined by R(x) = P(x) / Q(x),
where both P(x) and Q(x) are
polynomial functions is called a rational function.
Trigonometrical
Function: A
function f(x) = sin x, f(x) = cos x etc.,
then f(x) is called a trigonometrical function.
Exponential
Function: A
function in which the variable appears as an exponent (power) is called an
exponential function, e.g. (1) f(x) = ax or (2) f(x)
= 3x
Logarithmic
Function: A
function in which the variable appears as an argument of a logarithm is called
a logarithmic function, e.g. f(x) = loga (x).
► 연습문제1: Determine
whether f is even, odd, or neither. Then use Sage to visually check your
result.

Solution
Recall that,
If a
function f(x) satisfies f(-x) = f(x) for
every number x in its domain, then f(x) is called
an even function.
If a
function f(x) satisfies f(-x) = -f(x) for
every number x in its domain, then f(x) is called
an odd function.
Consider our
function f(x) = x / x2 +
1
Let’s find f(-x),
then

Therefore, f(x)
= x / x2 + 1 is
an odd function. ■
Verification
using SAGE:
Code:
var('x') # Define
variable "x"
f = plot(x/(x^2+1), x,
-6, 6, linestyle = "-", color = 'blue') #graph the function
function = text("y
= x/x^2+1 ", (3, 1), color = 'blue', fontsize = 15)
show(f + function,
ymax = 4, ymin = -2) # display graphs and texts one time
Output:

Notice that, the
graph of the function f(x) = x / x2 +
1 is
symmetric about the origin.
Therefore, f(x)
= x / x2 +
1 is
an odd function. ■
►
Note, for more detailed information with many examples of graphs of different
functions, click on the following link: http://matrix.skku.ac.kr/Cal-Book1/Ch1/
II. 극한(limit) [1], [2], [3], [7]
► Intuitive Definition of a Limit: Suppose f(x) is defined, when x is near the number a. (This means that f is defined on some open interval that contains a, except possibly at a itself. [x ≠ a]) Then we
write
![]()
and say that, “the
limit of f(x), as x approaches a,
equals L”
if we can make the
values of f(x) arbitrarily close to L (as
close to L as we like) by restricting x to
be sufficiently close to a (on either side of a), but not
equal to a.
An alternative
notation for
![]()
is f(x) → L as x → a, which is usually
read “f(x) approaches L as x approaches a”.
►
More detailed definition: 임의의 양수(positive) ε에 대하여, 만일 0
< |x - a| < δ 이면 |f(x) - b| < ε 되게 하는 적당한 양수(positive) δ가 존재하면, x가 a에 접근할 때 f(x)는 b에 수렴(converse)한다고 하고, b를 (x가 a에 접근할 때) f(x)의 극한(limit)이라고 부르며, limx→a f
(x) = b라고 쓴다. 수렴하지 않으면 발산(diverse)한다고 한다.
● Remark: 위의 [극한 정의, limx→a f
(x) = b]에 대한 기호 표기는 다음과 같다.
![]()
Here, ∀ means “for all” and ∃ means “there exists (at least one)”.
►
Additional definition of Left-Hand Limit:
►
Additional definition of Right-Hand Limit:
►
Intuitive Definition of an Infinite Limit: Let f be
a function defined on both sides of a, except possibly
at a itself. Then
![]()
means that the values
of f(x) can be made arbitrarily large (as large as we
please) by taking x sufficiently close to a,
but not equal to a.
Another notation
for limx→a f(x)
= ∞ is f(x) → ∞ as x → a, that can be read as
“the limit of f(x), as x approaches a,
is infinity” or “f(x) becomes infinity as x approaches a”
or “f(x) increases without bound as x approaches a”.

limx→a f(x) = ∞
► Limit Properties

►
Theorem 6: For
any rational function F with a in its domain, we have
![]()
If any of these
conditions is not fulfilled, the function is discontinuous at x = a.
●
Example:

► 연습문제2: Evaluate the limit and justify each step by indicating the appropriate Limit Law(s). Then check the result using SAGE.
Given:

Solution
To find out the
limit of the given problem, we use the following law:
Root law:

On applying the
Quotient law in equation (1) which is as follows:

By using the following
laws in equation (2):

On using the following
law in equation (3):



![]()
Therefore, the limit
of the given problem is,
.
■
Verification
using SAGE:
Code:
var( 'x' ) # Define
variable "x"
g(x) = sqrt((2*x^2 +
1)/(3*x - 2))
print('The limit of
the given problem:')
print(limit(g(x), x =
2)) # x = 2일 때 극한
Output:
![]()
► Note, for more detailed information about
the limit with examples of solving various problems, refer to the following
link: http://matrix.skku.ac.kr/Cal-Book1/Ch2/
III. 도함수(derivation)와 미분(differentiation) [1], [2], [3], [8] ► Definition: Let f: (a, b) → R be a function defined on an open interval (a, b). Then, the function f ’ defined by the following formula

is called the
derivative with respect to x of the function f,
where f ’ assigns
the number f ’(x) to
each x, so that we may regard f ’(x) as
a new function. Also, we note that the domain of f ’ is
the set {x | f’(x)
exists}.
►
Definition (Differentiable function): A function f is
differentiable at a if f ’(a) exists.
A function is differentiable on (a, b) if it is
differentiable at every number in (a, b). One of the typical
examples of a non-differentiable function is f(x) = | x | at x
= 0. There is a relationship between continuity and differentiability.
●
Remark(Definition of continuity):

If f(x) is
continuous at x = a, then
If f(x) is
continuous at x = b and limx→a g(x)
= b,
then
![]()
►
Intermediate Value Theorem: Suppose f(x) is
continuous on [a, b] and let M be
any number between f(a) and f(b).
Then there exists a number c such that,
(1) a < c < b
(2) f(c) = M

As we can see
from this image if we pick any value, M , that is
between the value of f(a) and the value of f(b) and
draw a line straight out from this point the line will hit the graph in at
least one point. In other words, somewhere between a and b the
function will take on the value of M. Also, as the figure
shows the function may take on the value at more than one place.
It’s also
important to note that the Intermediate Value Theorem only
says that the function will take on the value of M somewhere
between a and b. It doesn’t say just
what that value will be. It only says that it exists.
►
Theorem 7 (Differentiability Implies Continuity): If f is
differentiable at a, then f is
continuous at a.

►
Below is a basic table of derivatives.

►
Additional table of Differentiable Formulas.


► 연습문제3: (a) The curve y = 1/(1 + x^2) is called a Witch of Maria Agnesi. Find an equation of the tangent line to this curve at the point (-1, 1/2). (b) Illustrate
part (a) by graphing the curve and the tangent line on the
same screen using Sage.
Solution
(a) First,
differentiate y with respect to x using Quotient
Rule.

The slope of the
tangential line at (-1, 1/2) is,

The equation of
the tangent line at (x1,
y1) = (-1, 1/2),
whose slope m = 1/2 is,

(b) The
objective is to illustrate part (a) by graphing the curve and tangent line on
the same screen using Sage.
Code:
var('z' )
y = 1 / (1 + x^2)
df(x) = diff(y, x) #
differentiate y with respect ot x
print('dy/dx = ')
print(df(x))
print
x = -1 # substitute -1
for x
print("The slope
of the tangent line at (-1, 1/2) is ")
print(-2 * x / (x^2 +
1)^2)
# Note that, the
equation of the tangent line at (x1, y1) whose slope m, is y - y1 = m(x - x1)
print
print("The
equation of the tangential line is y = x/2 + 1")
print
print("Graph for
part (a) of the problem: ")
A = plot(1/(1 + z^2),
x, -4, 4, linestyle = "--", color = 'green') # graph the first
function
B = plot(z/2 + 1, x,
-4, 4) # graph the second function
P = point((-1, 1/2),
pointsize='50', color='red')
N1 = text("y = 1/(1
+ x^2)", (2.5, 0.5), color = 'green', fontsize = 15) # add the text on
given position
N2 = text("y =
1/2(x) + 1", (2.2, 1.5), fontsize = 15 )
PN = text("(-1,
1/2)", (-1.4, 0.6), fontsize = 13)
show(A + B + P + N1 +
N2 + PN, ymax = 1.5, ymin = -1.5) # display graphs and texts one time
Output:
.
■
●
Remark (아녜시의 마녀 /
Witch of Agnesi) [9]: 기하학에서, 아녜시의 마녀(Agnesi-魔女, 영어: witch of Agnesi)는 대수 곡선의 하나이다. 마리아 아녜시의 이름을 땄다.

► Note,
more information on Derivatives, Differentiation with various examples is available
at the following link: http://matrix.skku.ac.kr/Cal-Book1/Ch3/
Comment: This
is a short revision of several basic mathematical concepts such as function, limit, derivative and differentiation.
I tried to lay out the material in the form in which I understood it, I also
gave some simple examples of solving tasks manually and using SAGE. In the
Calculus book I found a problem related to the Witch Agnesi and
decided to try to solve it. The topic is quite interesting and there are many
different articles about it on the Internet, if you have time, I advise you to
read about it.
참고문헌:
[1] 이상구, 이재화., (2019), “인공지능을 위한 기초수학”,
BigBook, pp. 149~155
[2] James
Stewart., (2016), “Calculus – Early Transcendentals”, Cengage Learning, pp.
10~270
[3] Sang-Gu
Lee., (N/D), “SKKU Calculus (미적분학)”,
SKKU Matrix Lab.,
URL: Function: http://matrix.skku.ac.kr/Cal-Book1/Ch1/ | Limits
and Continuity: http://matrix.skku.ac.kr/Cal-Book1/Ch2/ | Theory of
Differentiation: http://matrix.skku.ac.kr/Cal-Book1/Ch3/
Function:
[4] 수학이야기., (2017), “함수의 정의”,
tistory,
URL: https://suhak.tistory.com/264
[5] MathsIsFun.,
(2017), “What is a Function?”, MathIsFun,
URL: https://www.mathsisfun.com/sets/function.html
[6] eMathZone.,
(N/D), “Types of Functions”, emathzone,
URL: https://www.emathzone.com/tutorials/calculus/types-of-functions.html
Limit:
[7] Paul's Online Notes., (2020), “The
Limit”, Paul Dawkins,
URL: https://tutorial.math.lamar.edu/classes/calci/thelimit.aspx
Differentiation:
[8] Engineering Maths First Aid Kit., (N/D),
“Table of derivatives”, mathcentre
Witch of Agnesi:
[9] 위키백과., (2019), “아녜시의 마녀”, Wikimedia Foundation,
URL: https://ko.wikipedia.org/wiki/%EC%95%84%EB%85%9C%EC%8B%9C%EC%9D%98_%EB%A7%88%EB%85%80
More about «Witch of
Agnesi»:
[*] John H. Lienhard.,
(2002), “The Witch of Agnesi”, Engines of Our Ingenuity,
URL: https://uh.edu/engines/epi1741.htm
[HW3] 미분의 응용 (Applications), 뉴턴-랩슨법 강의 요약 및 정리 + 근사 찾기 방법 비교 + 연습문제 풀기 + 코딩 실습 by 유가이 올렉산드르
Solved and Finalized by 유가이 올렉산드르
I. 최대값 최소값(Maximum
and Minimum Values) [1], [2], [3]
►Definition
(Increasing and Decreasing Function): A function f is
increasing over I if, for every a and b in I,
If a < b, then f(a)
< f(b).
(If the input a is
less than the input b, then the output for a is
less than the output for b.)
A function f is
decreasing over I if, for every a and b in I,
If a < b, then f(a)
> f(b).
(If the input a is
less than the input b, then the output for a is
greater than the output for b.)
●
Important remark:

►
Theorem 1: If f ‘(x)
> 0 for
all x in an open interval I, then f is
increasing over I.
If f ‘(x)
< 0 for
all x in an open interval I,
then f is decreasing over I.
●
Example:

►
Definition (Critical Values): A critical value of a function f is
any number c in the domain of f for
which the tangent line at (c, f(c)) is horizontal or
for which the derivative does not exist.
That is, c is
a critical value if f(c) exists and
f ‘(c)
= 0 or f ‘(c) does
not exist.

Note
the following:
1. f ‘(c)
= 0 at x
= c1, c2, c4, c7,
and c8. That is, the tangent
line to the graph is horizontal for these values.
2. f ‘(c) does
not exist at x = c3, c5,
and c6. The tangent line is
vertical at c3,
and there are corner points at both c5 and c6.
►
Intuitive Definition (최대값과 최소값): f(x)가 폐구간 [a, b]에서 연속이면 이 구간에서 f(x)가 최소값을 취하는 점 및 최소값을 취하는 점이 존재한다.

따라서, 1차도함수의 방정식의 근인 극값에서의 함수 값과 구간의 양 끝점에서의 함수값을 비교하여, 최댓값과 최솟값을 쉽게 구할 수 있다.
►
General Definition: Let c be a
number in the domain D of a function f.
Then f(c) is the
*
absolute maximum value of f on D if f(c)
≥ f(x) for all x in D.
*
absolute minimum value of f on D if f(c)
≤ f(x) for all x in D.
Note that,
an absolute maximum or minimum is sometimes called a global
maximum or minimum. The maximum and minimum values of f are
called extreme values of f.
►
Definition: The number f(c) is a
* local
maximum values of f if f(c) ≥ f(x) when x is
near c.
* local
minimum value of f if f(c) ≤ f(x) when x is
near c.
Note that,
in this definition, if we say that something is true near c,
we mean that it is true on some open interval containing c.

Figure: Absolute minimum f(a),
absolute maximum f(d), local minimum f(c), f(e),
local maximum f(b), f(d)
► Theorem 2
(The Extreme Value Theorem): If f is
continuous on a closed interval [a, b], then f attains
an absolute maximum value f(c) and an absolute minimum
value f(d) at some numbers c and d in [a,
b].
►
Theorem 3 (Fermat’s Theorem): If f has a
local maximum at c, and if f ‘(c) exists,
then f ‘(c)
= 0.
►
The Closed Interval Method: To find absolute maximum and minimum
values of a continuous function f on a closed interval [a, b]:
1. Find
the values of f at the critical numbers of f in (a,
b).
2. Find
the values of f at the endpoints of the interval.
3. The
largest of the values from Steps 1 and 2 is
the absolute maximum value; the smallest of these is the absolute minimum
value.
► 연습문제 1: Find
the absolute maximum and absolute minimum values of f on
the given interval.
f(x) = 3x4 –
4x3 – 12x2 +
1, [-2, 3]
Solution
In this problem, I
want to show you how to use the Closed Interval Method to find
the absolute maximum and minimum values of function.
Since f is
continuous on [-2, 3], use the close interval method.
f(x) = 3x4 –
4x3 – 12x2 +
1
f ‘(x)
= 12x3 –
12x2 –
24x = 12x(x2 –
x - 2) = 12x(x - 2)(x + 1)
Therefore, f ‘(x)
= 0 if 12x(x
- 2)(x + 1) = 0, that is x = -1, x = 0,
or x = 2.
Hence, the
critical numbers of the function are -1; 0; -2 and
it lies in the interval [-2, 3].
The value of f at
the critical numbers are,
f(-1) = 3(-1)4 –
4(-1)3 –
12(-1)2 +
1 = -4;
f(0) = 3(0)4 –
4(0)3 –
12(0)2 +
1 = 1;
f(2) = 3(2)4 –
4(2)3 –
12(2)2 +
1 = -31.
The value of f at
the endpoints of the interval are,
f(-2) = 3(-2)4 –
4(-2)3 –
12(-2)2 +
1 = 33;
f(3) = 3(3)4 –
4(3)3 –
12(3)2 +
1 = 28.
Compare these
values, the absolute maximum value is f(-2) = 33 and
the absolute minimum value is f(2) = -31.
Verification using SAGE
+ Graph plotting:
Code:
var('x')
f(x) = 3*x^4 - 4*x^3 -
12*x^2 + 1
P = plot(f(x), x, -4, 4,
linestyle = "-", color = 'green')
show(P, ymax = 35, ymin
= -35)
S = solve(diff(f(x)) ==
0, x) # find the critical numbers
print('Critical numbers
of function', S)
maximum = max(f(-1),
f(0), f(2), f(-2), f(3)) # find maximum value
minimum = min(f(-1),
f(0), f(2), f(-2), f(3)) # find minimum value
print
print('Absolute maximum
value: ')
print(maximum)
print('Absolute minimum
value:')
print(minimum)
Output:
.
■
II. 뉴턴-랩슨법 [1], [3], [4], [5], [6], [7]
►
Definition (Newton’s method): 비선형방정식의 근을 결정할 때 자주 사용하는 방법 중 하나이다. 개발자인 뉴턴(Newton)과 랩슨(Raphson)의 이름을 합쳐서 뉴턴-랩슨법이라고도 한다.

►
Additional definition: The Newton-Raphson method
(also known as Newton’s method) is a way to quickly find a good
approximation for the root of real-valued function f(x) = 0.
It is uses the idea that a continuous and differentiable function can be approximated
by a straight line tangent to it.
Unlike the
bisection and false position methods, the Newton-Raphson (N-R) technique
requires only one initial value x0,
which we will refer to as the initial guess for the root.
To see how the N-R method works, we can rewrite the function f(x) using
a Taylor series expansion in (x-x0):
f(x) = f(x0)
+ f'(x0)(x-x0)
+ 1/2 f''(x0)(x-x0)2 +
... = 0
where f'(x) denotes
the first derivative of f(x) with respect to x, f''(x) is
the second derivative, and so forth. Now, suppose the initial guess is pretty
close to the real root. Then (x-x0) is
small, and only the first few terms in the series are important to get an
accurate estimate of the true root, given x0.
By truncating the series at the second term (linear in x),
we obtain the N-R iteration formula for getting a better estimate of the true
root:

Thus the N-R
method finds the tangent to the function f(x) at x=x0 and
extrapolates it to intersect the x axis to get x1.
This point of intersection is taken as the new approximation to the root and
the procedure is repeated until convergence is obtained whenever possible.
Mathematically, given the value of x = xi at
the end of the ith iteration, we obtain xi+1 as

●
Remark: Note
that, x0 should be closer
to the root you need than to any other root (if the function has multiple
roots).
►
Geometrical Representation: Here is a picture to demonstrate
what Newton’s method actually does:

We draw a tangent line
to the graph of f(x) at the point x = xn .
This line has slope f'(xn) and
goes through the point (xn,
f(xn)).
Therefore it has the equation y = f'(xn)(x−xn)+f(xn).
Now, we find the root of this tangent line by setting y = 0 and x
= xn+1 for our new
approximation. Solving this equation gives us our new approximation, which
is xn+1 =
xn – f(xn)
/ f'(xn).
●
Remark: 예를 들면, 이분법은 함수 f(x) 값만 알아도 되지만, 뉴턴법은 함수 f(x)와 더불어 함수 f(x)의 1차 도함수 f'(x) 값도 반드시 알아야 하는 단점이 있다. 그러므로 뉴턴법을 사용할 때는 반드시 근사시키는 함수 f(x)가 미분 가능한지를 먼저 확인해야 한다.
♦ 근 찾기 방법 비교
► 근의 찾기 기본 방법에 대한 간략한 정의:
(1) 이분법: 구간의 중앙값을 이용하여 함수의 근을 찾는 방법이다.
● 이분법 공식
초기 구간 [a1,
b1]
연속 구간 [ai,
bi]
중앙값 ci =
(ai + bi)
/ 2
절대 오차 |α - cn|
≤ (1 / 2)n (b1 –
a1)
(2) 뉴턴법/뉴턴-랩슨법: 초기 근삿값 한 개를 이용하여 미분 가능한 연속 함수 f(x)와 함수의 1차 도함수 f'(x)를 이용하여 함수의 근을 찾는 방법이다.
● 뉴턴법 공식
xn+1 =
xn – ( f(xn)
/ f'(xn)
) [n = 0, 1, 2, ···]
(3) 할선법: 뉴턴법을 기초로 이용하지만 뉴턴법과 다르게 1차 도함수 f'(x)의 평가가 필요 없는 함수의 근을 찾는 방법이다.
● 한선법 공식
xn+1 =
xn – f(xn)·(
(xn – xn-1)
/ (f(xn)
– f(xn-1))
) [n = 1, 2, 3, ···]
(4) 가위치법: 구간의 폭을 연속적으로 좁히면서 정확한 근을 구하지 않고 구간의 끝점들을 직선으로 연결하고 직선의 절편의 위치를 결정하여 함수의 근을 찾는 방법이다.
● 가위치법 공식
mn =
( (f(bn)
– f(an))
/ (bn -
an) ) [n
= 0, 1, 2, ···]
xn =
an – ( (f(an))
/ (mn)
) [n
= 0, 1, 2, ···]
► 근 찾기 방법 비교하기
수치해석에서 이분법, 뉴턴법/뉴턴-랩슨법, 할선법, 가위치법을 이용하면 함수의 실제 근 찾기가 가능하다. 이 방법들은 반복 실행을 통해 점검 실제 근에 수렴하는 근삿값을 추정한 후에 함수 f(x)와 이전의 추정된 값을 토대로 이후의 값을 계산한다.
● 이분법: 근삿값 두 개의 중앙값을 이용한 반복 수행으로 비교적 느린 속도로 실제 근에 수렴한다. 이분법은 뉴턴법보다 실제 근에 수렴하는 속도는 느리지만 항상 수렴한다. 반면에 뉴턴법은 근 찾기 방법 중에서 수렴 속도가 가장 빠르지만 종종 수렴에 도달하지 않는 경우도 있다.
● 뉴턴법/뉴턴-랩슨법: 근 찾기에 매우 강력한 기술로 초기 근삿값 한 개만 필요로 한다. 처음 추정하는 근삿값이 실제 근에 매우 근접하게 선택되는 경우에는 가장 빠르게 실제 근에 수렴되는 방법이다. 반면에 실제 근에서 너무 멀리 떨어진 근삿값에서 시작하면 수렴하지 않을 수 있다. 뉴턴법은 할선법보다 적은 반복으로 근을 찾으므로 수렴 속도가 빠르다. 그러나 반복 실행으로 찾는 근삿값에서 함수 f(x)와 1차 도함수 f'(x)의 더 복잡한 계산을 필요로 하기에 근 찾기에 더 많은 시간을 소모하는 단점이 있다.
● 할선법: 뉴턴법과 거의 비슷하게 사용하는 근 찾기 방법이다. 할선법은 초기 근삿값 두 개가 필요하지만 반복되는 각각의 근삿값에서 함수 f'(x)만 계산하면 된다. 할선법은 이분법과 가위치법보다 더 좋은 근사치를 얻지만 실제 근에 완전하게 수렴하지 않는 단점이 있다.
● 가위치법: 이분법과 할선법을 결합시킨 방법이다. 할선법의 반복(recurrence) 공식은 뉴턴법의 공식에서 유도할 수 있다. 이분법과 다르게 뉴턴법 혹은 할선법은 주어진 구간에 대한 구간법 이용이 불확실하다. 가위치법은 할선법과 동일한 방법으로 근삿값을 추정하지만 반복할 때마다 구간법을 이용한다. 가위치법은 이분법보다 신속하게 근을 찾을 수 있지만, 이분법보다 계산이 복잡하다. 가위치법은 끝점 두 개가 필요하고 항상 실제 근에 수렴한다.
► Remark: 위의 모든 내용을 쉽게 이해하려면 다음 표를 참조하십시오.
|
방법 |
필요한 초깃값 |
수렴 여부 |
수렴 속도 |
필요한 함수 |
|
이분법 |
2 |
항상 수렴 |
느림 |
f(x) |
|
뉴턴법 |
1 |
대개의 경우 수렴 |
가장 빠름 |
f(x), f'(x) |
|
할선법 |
2 |
대개의 경우 수렴 |
빠름 |
f(x) |
|
가위치법 |
2(끝점) |
항상 수렴 |
적당히 빠름 |
f(x) |
연습문제 2: 다음 비선형방정식이 구간 [0,
1]에서 양의 근이 하나 존재한다. 뉴턴법을 이용하여 반복해서 나타나는 근들을 계산하라.
f(x) = x3 +
2x2 – 1
Solution
함수 f(x)의 1차 도함수는 f'(x)
= 3x2 +
4x이다. 추정하는 초깃값 x0는 주어진 중앙값 0.5로 정하자. 뉴턴-랩슨법 공식과 x0를 이용하면 순서대로 추정하려는 근 x1,
x2, ···를 계산할 수 있다. 뉴턴-랩슨법의 반복 계산은 다음과 같이 실행한다.
xn+1 = xn – ( (xn3 + 2xn2 - 1) / (3xn2 + 4xn) ) [n ≥ 0]
위의 식에 n = 0을 대입하면 다음과 같다.
x1 =
x0 – ( (x03 + 2x02 -
1) / (3x02 + 4x0) ) = 0.5 – ( ((0.5)3 +
2(0.5)2 - 1) / (3(0.5)2 + 4(0.5)) ) =
0.6363636364
계속해서 n = 1, n
= 2, n = 3을 순서대로 대입하면 다음과 같은 추정하려는 각각의 근을 구할 수 있다.
x2 = x1 – ( (x13 + 2x12 - 1) / (3x12 + 4x1) ) = 0.6363636364 – ( ((0.6363636364)3 + 2(0.6363636364)2 - 1) / (3(0.6363636364)2 + 4(0.6363636364)) ) = 0.6183816184
x3 = x2 – ( (x23 + 2x22 - 1) / (3x22 + 4x2) ) = 0.61838162 – ( ((0.6183816184)3 + 2(0.6183816184)2 - 1) / (3(0.6183816184)2 + 4(0.6183816184)) ) = 0.6180341174
x4 =
x3 – ( (x33 +
2x32 -
1) / (3x32 +
4x3) ) = 0.6180341174 – (
((0.6180341174)3 +
2(0.6180341174)2 -
1) / (3(0.6180341174)2 +
4(0.6180341174)) ) = 0.6180339888
실제 근 α
= 0.6180339889와 추정한 결과를 비교해보니 x4 값이 실제 근과 일치한다.
Verification using SAGE:
Code:
#Use a loop to compute
iterations of Newton-Raphson's Method
#Use a loop to compute
iterations of Newton-Raphson's Method
x = var('x')
f(x) = x^3 + 2*x^2 – 1
fp = diff(f,x)
NewtonIteration(x) = x -
(f/fp)(x)
xn = 0.5;
print('x0 =', xn);
for i in range(10):
xn
= N(NewtonIteration(xn),digits=10);
print('x',
i+1, '=', xn);
print
print("This is the
exact answer for comparison: ")
print(solve(f(x)==0, x))
print
print("Note that,
we have been trying to estimate the postive root, which is 1/2*sqrt(5) - 1/2 ≈
0.6180339889")
Output:

●
Remark: for
easier understanding, I gave the code without using a loop (the results are the
same), but the code with a loop is preferable.
x = var('x')
f(x) = x^3 + 2*x^2 - 1
fp = diff(f,x)
NewtonIteration(x) = x -
(f/fp)(x)
x0 = 0.5
print(x0)
x1 =
N(NewtonIteration(x0))
print(x1)
x2 =
N(NewtonIteration(x1))
print(x2)
x3 =
N(NewtonIteration(x2))
print(x3)
x4 =
N(NewtonIteration(x3))
print(x4)
Additional
verification using Sage Grapher for Newton's Method:
.
■
Comment: “Newton's method for solving
equations is significant because it is often one of the fastest converging
methods. In particular, if the function is convex near a root and at the
initial value, x0, f(x0)
> 0, then it converges. Applying it to the derivative of a function, it can
be used for optimisation. Furthermore, using matrices, Newton's method
generalises to solving simultaneous equations and optimising functions of more
than one variable.” I also want to add to the above that the Newton-Raphson
Method is often used in Medical Engineering, for example, when creating a knee
joint prosthesis in the most suitable shape for a patient.
참고문헌:
[1] 이상구, 이재화., (2019), “인공지능을 위한 기초수학”,
BigBook, pp. 156~158
[2] James
Stewart., (2016), “Calculus – Early Transcendentals”, Cengage Learning, pp.
276~291; 345~348
[3] Sang-Gu
Lee., (N/D), “SKKU Calculus (미적분학)”,
SKKU Matrix Lab.,
URL: (Application of
Differentiation) http://matrix.skku.ac.kr/Cal-Book1/Ch4/
[4] Mark
D. Smith., (1998), “Newton-Raphson Technique”, MIT,
URL: http://www.mit.edu/course/10/10.001/Web/Course_Notes/NLAE/node6.html
[5] Ariel
Gershon, Edwin Yung, and Jimin Khim., (2020), “Newton Raphson Method”,
BRILLIANT,
URL: https://brilliant.org/wiki/newton-raphson-method/
[6] 방성완., (2018), “MATLAB으로 배우는 공학 수치해석/Numerical
Analysis with MATLAB”, 한빛아카데미,
pp.292~294
[7] Terry
Moore., (2016), “Calculus: What is the significance of Newton’s Method?”,
Quora,
URL: https://www.quora.com/Calculus-What-is-the-significance-of-Newtons-Method
2개의 댓글
이상구(LEE SANGGU)8월 1일 오전 4:10
아주 자세한
... 잘 정리된 요약 입니다^^
Good.
김진웅(2015****73)8월 1일 오후 2:19
방정식의 근을 찾는 방법으로 뉴턴법 뿐만이 아니라 이분법,
할선법, 가위치법이 있고 그것들의 장단점을 알 수 있었습니다. 요약 감사합니다.
[HW3] 적분 (Integral) 강의 요약 및 정리 + 연습문제 풀기 + 코딩 실습 by 유가이 올렉산드르
Solved and
Finalized by 유가이 올렉산드르
I. 적분
- 개요
어떤 구간에서 정의된 함수 f(x)에 대하여 이 구간의 모든 x에 관하여 F’(x) = f(x)를 만족하는 함수 F(x)가 존재할 때 F(x)를 f(x)의 원시함수 또는 부정적분(indefinite integral)이라고 한다. f(x)가 주어졌을 때 그 부정적분 F(x)를 구하는 것을 f(x)를 적분한다고 한다.
f(x)의 부정적분 ∫f(x)dx로 나타내고 ∫를 적분기호, f(x)를 피적분함수, dx를 적분변수라고 한다. F(x)가 f(x)의 한 부정적분이면
∫f(x)dx = F(x) + C (C는 임의의 상수)이다.
위 식에서 C를 적분상수라고 한다.
[a,
b]에서 연속인 함수 f(x)는 [a, b]에서 적분가능이라고 하며, f(x)의 a로부터 b까지의 정적분(definite integral)을
로 정의한다.

S = { (x, y) |a ≤ x ≤ b, 0 ≤ y ≤ f(x)| }
Consider a general region S.
Subdivide S into n strips S1, S2, … ,Sn of equal
width Δx = (b - a) / n as in Figure
below with n subintervals
[x0, x1], [x1, x2], [x2, x3], … ,[xn-1, xn]
where x0 = a and xn = b, and with the right
endpoints of the subintervals given by
x1 = a + Δx, x2 = a + 2Δx, x3 = a + 3Δx, …

The ith strip S1 is approximated
by f(xi)Δx, which is the area of
the ith rectangle with width Δx and height f(xi).

We
approximate the area of S by the sum of the
areas of these rectangles, which is
Rn = f(x1)Δx + f(x2)Δx + … + f(xn)Δx
As n → ∞, this approximation
appears to become better and better.
▶Intuitive
Definition(Area of region): The area A of
the region S that lies under the graph of the
continuous function f is the limit of the sum
of the areas of approximating rectangles:
-----(1)
It can also be shown that we get the same value
if we use left endpoints provided the right hand limit exists:
-----(2)
Instead of using
left endpoints or right endpoints of the ith rectangle can
be taken as the value of f at any sample point xi* in the ith
subinterval [xi-1, xi]. Figure below shows
approximating rectangles when the sample points are not chosen to be endpoints.

A
more general expression for the area of S is
-----(3)
● Remark: Sums with many
terms are written more compactly using sigma notation. For example,
![]()
Then
equations (1), (2), and (3) above,
can be rewritten as

Note
that,

Example:
Given
function: f(x) = cos(x) + 1.
Using
the Area of Regions method described above, we can find the area under the
curve on the interval [0, pi] as follow:

http://matrix.skku.ac.kr/cal-lab/Area-Sum.html
▶ Intuitive Definition(적분): 적분하면 아마도 다음과 같은 식이 떠오를 것이다.
![]()
위 식의 뜻은, “x를 a부터 b까지 변화시키면서 f(x)에 dx를 곱한 것을 전부 합쳐라”라는 의미이다. 결국 다음과 같은 의미이다.

먼저, 적분기호 ∫는 인티그랄(integral)이라고 읽는데, 잘 보면 영어의 s자를 땡겨놓은거랑 비슷하다. Sum(합치다)의 s를 길게 늘어뜨린 게 적분기호 ∫
이다.
다음, f(x)dx가 남았는데, f(x)에다가 dx를 고하라는 말이다. 먼저, f(x)가 의미하는 것을 함수 그래프를 통해 살펴보자.

함수값 f(x)는 y = f(x) 그래프에서 x가 x일때의 y값, 즉, 위 그림에서 빨간색 선의 높이(길이)이다.
마지막, dx는 미분에서 나오는 dx랑 같은 말인데, x의 순간적인 변화량이다. dx와 관계된 표현으로 △x ('델타엑스'라고 읽는다)가 있는데 △x는 어떤 구간에서의 x의 변화량을 나타낸다. 만일, x가 x1에서 x2로 값이 변했다면 △x = x2 - x1이다. dx는 △x를 무한히 작은 값으로 보낸 극한에서의 개념이다. 예를 들어, 어떤 직사각형이 있고 이 직사각형의 밑변의 길이가 △x라 하자. 이제 이 직사각형을 세로방향으로 잘라서 둘로 나누자. 그럼 밑변의 길이가 △x/2가 된다. 그런데 이 사각형을 무한히 계속 나눈다면 하나의 기다란 선처럼 될 것이고, 이 선의 밑변의 길이는 0은 아니지만 0에 무한히 가까운 값이 될 것이다. 상상속에서만 존재하는 이 선의 밑변의 길이가 바로 dx이다 (편의상 dx를 길이라고 했지만 dx는 "+", "-" 부호를 갖는 값이다. x가 증가하면 “+”, 감소하면 “-“이다. dx의 정확한 표현은 x의 순간변화량이다).
그렇다면, f(x)dx가 의미하는 것은 빨간색 선의 넓이(면적)라는 것이다 (f(x)가 높이, dx가 밑변).
그럼, 다시 원래 식으로 돌아가서 아래 식과 그림으로 찬찬히 감상해 보자.
![]()

x를 a부터 b까지 변화시키면서 f(x)에다가 dx를 곱해서 합친다.
● Additional remark:
Example: What is an integral of 2x?
We know that the derivative of x2 is 2x,
so an integral of 2x is x2 (See Figure
below).

In integral notation:

The symbol for “Integral”
is a stylish “S” (for “Sum”, the idea of
summing slices)
After the Integral Symbol we put the function we want
to find the integral of (called the Integrand), and then finish
with dx to mean the slices go in the x direction
(and approach zero in width). And here is how we write the answer:
Here C is the “Constant
of Integration”. It is there because of all the function whose
derivative is 2x:

The derivative of x2 + 4 is 2x,
and the derivative of x2 + 100 is also 2x,
and so on. Because the derivative of a constant is zero.
So,
when we reverse the operation (to find the integral) we only know 2x,
but there could have been a constant of any value. Therefore, we wrap up the
idea by just writing + C at the end.
▶ Basic Properties of
Integral:

![]()

▶ Integration Rules:

▶적분에 관한 평균값의 정리:
f(x)가 [a, b]에서 연속이면
![]()
이고, ξ가 a과 b사이에 적어도 하나 존재한다.

▶ 미적분학의 기본정리 (적분과 미적분의 연결고리): 적분에는 정적분과 부정적분이 있는데 미분과 반대말 관계에 있는 건 정확히 말하면 부정적분이다. 부정적분의 정의가 '미분해서 f(x)가 되는 함수를 f(x)의 부정적분이라 정의한다'이다. 예를 들어, f(x) = 2의 부정적분은 F(x) = 2x + C이다 (C는 임의의 상수). 그러니, 미분과 부정적분은 완전히 서로 역(반대말)관계이다.
반면에 정적분은 미분과는 직접적인 관계는 없으며, 구분구적법과 관계된 말이다. 적분의 이해에서 설명한 바와 같이, 정적분은 어떤 정해진 구간에서 함수값을 미세하게 나누어 합친 값으로서 적분(積分)의 한자 의미에 보다 가까운 말이다. 부정적분이 하나의 함수인 반면에 정적분은 어떤 수치 또는 값임에 주의하자.
다만, 정적분은 부정적분과 계산상의 연관 관계를 갖는다. 정적분 값을 곧이 곧대로 정의대로 구하지 않고 손쉽게 구하는 한 방법은 먼저 부정적분을 구한 후에 부정적분의 차를 이용해서 정적분 값을 계산하는 것이다. 즉, f(x)의 한 부정적분을 F(x)라 할 때,
![]()
와 같이 정적분 값을 부정적분을 이용해서 손쉽게 계산할 수 있다. 이 관계식은 미적분학에 있어서 가장 기본적인 정리 (fundamental
theorem) 중 하나이다.
정리해 보면, '미분과 부정적분은 서로 반대말 관계에 있다. 정적분은 미분이나 부정적분과는 별개의 개념으로서 구분구적법, 면적, 부피 등에 관계된 개념이다. 다만, 정적분을 계산하는데 부정적분이 활용된다'이다.
Also, note that:
![]()
▶ Definition(Riemann
sum): In mathematics, a
Riemann sum is a certain kind of approximation of an integral by a finite sum.
The sum is calculated by partitioning the region into shapes (rectangles,
trapezoids, parabolas, or cubics) that together form a region that is similar
to the region being measured, then calculating the area for each of these
shapes, and finally adding all of these small areas together. This approach can
be used to find a numerical approximation for a definite integral even if the
fundamental theorem of calculus does not make it easy to find a closed-form
solution.
Because the region filled by the small shapes is usually not exactly the same
shape as the region being measured, the Riemann sum will differ from the area
being measured. This error can be reduced by dividing up the region more
finely, using smaller and smaller shapes. As the shapes get smaller and
smaller, the sum approaches the Riemann integral.
▶ Intuitive Definition: Let us decompose
a given closed interval [a, b] into n subintervals
by inserting n – 1 points x1, x2, … ,xn-1 such that
a = x0 < x1 < x2 < … < xn = b.
Such
a collection of points {x0, x1, … ,xn} is called a
partition of [a, b], and this partition determines
the following n closed subintervals:
[x0, x1], [x1, x2], … ,[xn-1, xn].
Let [xk-1, xk] denote kth
closed subinterval of the partition, and let Δxk denote the
length of the kth subinterval. Note that Δxk need not be the
same for each subinterval.
Therefore,
if f is defined on the closed interval [a,
b] and ck is any point
in [xk-1, xk], then a Riemann
sum is defined as
![]()
A Riemann
sum can be visualized as a division of (approximately) the area under the
curve f(x) on [a,
b] into n adjacent
rectangles spanning the interval, where the kth rectangle
has width Δxk and height f(ck).
The area of each rectangle is Δxk (height times width). The sum of the areas
of all rectangles approximates the actual area under f on [a,
b] and is equal to the Riemann sum. Note that ck could be any point in the kth
subinterval, which means the definition leaves some latitude in choosing the
height of each of the n rectangles.
▶ Relationship to
Definite Integral:
The
Riemann sum of a function is related to the definite integral as follows:

● Remark(Some specific types of
Riemann sums):
(1) If ck = xk-1 for all k,
then S is called a left rule or left
Riemann sum.
(2) If ck = xk for all k,
then S is called a right rule or right
Riemann sum.
(3) If ck = (xk + xk-1) / 2 for all k,
then S is called the midpoint
rule or middle Riemann sum.
(4) If f(ck) = sup f([xk-1, xk]) (that is, the
supremum of f over [xk-1, xk]), then S is
defined to be an upper Riemann sum or upper
Darboux sum.
(5) If f(ck) = inf f([xk-1, xk]) (that is, the
infimum of f over [xk-1, xk]), then S is
defined to be an lower Riemann sum or lower Darboux
sum.
All these
methods are among the most basic ways to accomplish numerical integration.
Loosely speaking, a function is Riemann integrable if all Riemann sums
converge as the partition "gets finer and finer".
While not
technically a Riemann sum, the average of the left and right Riemann sums is
the trapezoidal sum and is one of the simplest of a very general way of
approximating integrals using weighted averages. This is followed in complexity
by Simpson's rule and Newton–Cotes formulas.
Any
Riemann sum on a given partition (that is, for any choice of ck between ck-1 and xn) is contained between
the lower and upper Darboux sums. The forms the basis of the Darboux integral,
which is ultimately equivalent to the Riemann integral.

Figure: (1) Left
Riemann sum; (2) Right Riemann sum; (3) Midpoint
rule [from left to right]
▶ Definite
Integral as a Limit of a Sum: We can express definite integral as a
limit of the sum of a certain number of terms. Let f(x) be
a continuous function in the interval [a, b].
Divide a --- b into n equal
parts such that the width of each part is h. Then,
nh = b – a
The definite
integral of a function f(x) in the
interval [a, b] can be defined as

Which the help
of this formula, we can evaluate some simple definite integrals. The process of
finding defined integrals with the use of the above formula is known as
definite integral as a limit of sum.
▶ Summation of Series with
help of Definite Integrals: Consider the “limit of sum” formula defined
above, i.e.
![]()
Working rules:

● Remark: Below is a table
with all basic formulas for Riemann Sum (for more
details see explanations above).

연습문제1: Estimate the
following integral using the Riemann Sum method.
![]()
Solution
By
integrating the given equation x2 + 2x - 3 over the interval [0, 6],
we got a result equal to 90.
Case1: Using the Riemann Sum(Midpoint rule) with n
= 10, the area under
the curve on the segment [0, 6] was
approximately 82.82. In this case, the error
was 0.18.
Case2: For comparison, using the
Riemann Sum(Midpoint rule) with n = 20, the area
under the curve on the segment [0, 6] was
approximately 89.955. In this case, the error was
only 0.045.

Case1 and Case2 [from
left to right]
With an
increase in the number n, that is, increasing the
number of rectangles(in our case) into which we divide the given area under the
curve, we bring the value of the area under the curve closer to its actual
value, that is, we reduce the error.
연습문제2: Evaluate the
integral.
![]()
Solution
First,
recollect the Fundamental Theorem of Calculus. Second condition states that
if f is continuous on [a, b] and F is
an anti-derivative of f that is, F’
= f, then
![]()
Let f(x)
= 4 / sqrt(1 – x2)
Then,
anti-derivative of f(x) is,

By
using the Fundamental Theorem of Calculus – Second condition,
![]()

Verification
using SAGE + graph plotting:
Code:
f(x)
= 4/sqrt(1 - x^2)
P1
= plot(f(x), 1/2, 1/sqrt(2), fill = "axis") # fill the area between
f(x) and x-axis
P2
= plot(f(x), 0.4, 1/sqrt(2) + 0.05, color = 'blue') # graph f(x)
show(P1
+ P2) # show P1 and P2
print(integral(f(x),
x, 1/2, 1/sqrt(2)).simplify_full()) # integrate f(x) on (1/2, 1/sqrt(2))
print((integral(f(x),
x, 1/2, 1/sqrt(2)).simplify_full()).n(digits=10)) # final answer in decimal
form
Output:
.■
Comment: As you know,
usually, scientists try to express all physical phenomena in the form of a
mathematical formulas. Once we have a formula, then we can use it to calculate
anything. And the integral is one of the main tools for working with functions.
For example, if we have the formula for a circle, we can use the integral to
calculate its area. If we have a sphere formula, then we can calculate its
volume. Through integration, one finds energy, work, pressure, mass, electric
charge, and many other quantities. Therefore, I tried to use various sources to
explain in detail the meaning of the integral and talk about its capabilities.
Also, through solving relatively simple tasks, I tried to visualize theoretical
information for a deeper understanding of the topic.
참고문헌:
[1] 이상구, 이재화., (2019), “인공지능을 위한 기초수학”, BigBook, pp.
159~161
[2] James Stewart., (2016), “Calculus – Early
Transcendentals”, Cengage Learning, pp. 366~401; 428~434
[3] Sang-Gu
Lee., (N/D), “SKKU Calculus (미적분학)”, SKKU Matrix Lab.,
URL:
(Integrals) http://matrix.skku.ac.kr/Cal-Book1/Ch5/
[4] darkpgmr., (2013), “미분 적분 제대로 알자”, Daum/Tistory,
URL: https://darkpgmr.tistory.com/45
[5] mathisfun.,
(N/D), “Introduction to Integration”, MathIsFun,
URL: https://www.mathsisfun.com/calculus/integration-introduction.html
[6] MIT.,
(N/D), “Properties of Integrals”, MIT,
URL: http://math.mit.edu/~jorloff/suppnotes/suppnotes01-01a/01pi.pdf
[7] OSU.,
(N/D), “Integral Calculus Formula Sheet”, OSU,
URL: https://mslc.osu.edu/sites/default/files/Integral%20Calculus%20Formula%20Sheet_0.pdf
[8] Wikipedia.,
(2020), “Riemann sum”, Wikimedia Foundation,
URL: https://en.wikipedia.org/wiki/Riemann_sum
[9] Gautam Sharma, Sravanth Chebrolu, Joe Plaza,
and others., (2020), “Riemann Sums”, Brilliant,
URL: https://brilliant.org/wiki/riemann-sums/
1개의 댓글
이상구(LEE SANGGU)8월 2일 오후 7:42
Good job^^
[Final OK by SGLee] [HW3] Finalized by 유가이 올렉산드르, 답변 by 이상구 교수님, Solved by 이상현 - 뉴턴 방법 증명
[HW3] Finalized by 유가이 올렉산드르, 답변 by 이상구 교수님, Solved by 이상현 - 뉴턴 방법 증명
Solved by 이상현
답변 by 이상구 교수님
Finalized
by 유가이 올렉산드르
임의의 함수 f(x)와 미지수 a1,a2 로 증명했습니다.

임의의 함수 f(x)와 미지수 a1, a2 로 증명했습니다.
답변 by 이상구 교수님(7월 29일 오후 2:04)
http://matrix.skku.ac.kr/cal-lab/cal-Newton-method.html에서 실습^^
http://matrix.skku.ac.kr/Cal-Book/part1/CS-Sec-4-5-Sol.html 참조
추가 내용:
► Derivation
of Newton's method using tanget line properties [1]:
Let's
suppose that we want to approximate the solution to f(x) = 0 and
let's also suppose that we have somehow found an initial approximation to this
solution say, x0.
This initial approximation is probably not all that good, in fact it may be
nothing more than a quick guess we made, and so we had like to find a better
approximation. To do this, first,
we will get the tangent line to f(x) at x0.
y = f(x0) + f’(x0)(x – x0)
Now, take a look at the graph
below.

Here, the blue line is the tangent
line at x0. We can see that this line will cross
the x-axis much
closer to the actual solution to the equation than x0 does. Let’s call this point where
the tangent at x0 crosses the x-axis, x1 , and we will use this point as
our new approximation to the solution.
We know that the coordinates of
this point is (x1, 0), and we know that it’s on the tangent
line, so plug this poit into the tangent line and solve for x1 as follows,
0 = f(x0) + f’(x0)(x1 – x0)
-f(x0) = f’(x0)(x1 – x0)
x1 – x0 = - f(x0) / f’(x0)
x1 = x0 – f(x0) / f’(x0)
So, we can find the new
approximation provided the derivative isn’t zero at the original approximation.
Now, we repeat the whole process
to find an even better approximation. We form up the tangent line to f(x) at x1 and use its root, which we will
call x2, as a new approximation to the actual
solution. If we do this we will arrive at the following formula
x2 = x1 – f(x1) / f’(x1)
This point is also shown on the
graph above and we can see from this graph that if we continue following this
process, we will get a sequence of numbers that are getting very close to the
actual solution. This process is called Newton’s Method or Newton-Raphson
Method. Summarizing all of the above, we get the following general
definition of Newton’s Method.
● If xn is an approximation solution
of f(x) = 0 and
if f’(xn) ≠ 0, the next approximation is given by,
xn+1 =
xn –
f(xn)
/ f’(xn). ■
► Derivation of Newton's method using tanget line
properties and gradient [2]:

Suppose we are now in axis x0, first, we will find tangent line
of f(x) in
axis x0 (tangent line in this picture is
the red-dash line). This first tangent line intersects axis x in x1. Then, we find the next tangent line
of f(x) in x1. This tangent line will intersect
axis x in x2. By iterating this process, we will
reach the root location. That is the general idea how Newton’s method is used
for finding root.
Now, let’s to derive the mathematical
formula of Newton’s method. Tangent line of f(x) in x0 is a line that is parallel
with f(x) in axis x0. To get the required linear function we
can use the following formula:
y = mx + c, where gradient m is same
with gradient of f(x) at x0 = f’(x0)
To find the value of c, we can plug a
pair x--y values
of f(x) to y = mx + c. In
this case, x =
x0 and y = f(x0).
So, now, we get:
y = mx + c
y = f’(x0)x + f(x0) – f’(x0)x0
y = f(x0) + f’(x0)[x – x0]
We know that our tangent line
intersects axis x at (x1, 0). Thus, by plugging this coordinate to our tangent
line function, we get:
y = f(x0) + f’(x0)[x – x0]
0 = f(x0) + f’(x0)[x1 – x0]
x1 – x0 = - f(x0) / f’(x0)
x1 = x0 – f(x0) / f’(x0)
Thus, continuing this process we
can get the general
formula for Newton's Method:
xn+1 =
xn –
f(xn)
/ f’(xn).
■
► Derivation of Newton's method using Tylor
Series [3]:
Consider that, you look for the
zero of f(x).
At a starting point x0 make a Taylor Series limited to first order.
f(x) = f(x0) + f’(x0)(x-x0) + O((x – x0)2)
Ignore the higher order terms and
solve for x and
let us call x1 the solution of
0 = f(x0)
+ f’(x0)(x – x0)
=>
x1 –
x0 =
- f(x0)
/ f’(x0)
x1 = x0 – f(x0) / f’(x0)
Repeating this process, we get:
f(x) = f(x1) + f’(x1)(x – x1) + O((x – x1)2)
Ignore the higher order terms and
solve for x and
let us call x2 the solution of
0 = f(x1)
+ f’(x1)(x – x1)
=>
x2 –
x1 =
- f(x1)
/ f’(x1)
x2 = x1 – f(x1) / f’(x1)
Repeat again and again to get
the general
Newton’s Method equation:
xn+1 =
xn –
f(xn)
/ f’(xn).
■
실습/추가 연습문제: 다음 비선형방정식이 구간 [0,3]에서 양의 근이 하나 존재한다. 뉴턴법을 이용하여 반복해서 나타나는 근들을 계산하라.
f(x) = x3 - 3x2 + 2
Solution
함수 f(x)의 1차 도함수는 f'(x) = 3x2 -6x이다. 추정하는 초깃값 x0는 주어진 중앙값 2.5로 정하자. 뉴턴-랩슨법 공식과 x0를 이용하면 순서대로 추정하려는 근 x1,
x2, ···를 계산할 수 있다. 뉴턴-랩슨법의 반복 계산은 다음과 같이 실행한다.
xn+1 = xn – ( (xn3 - 3xn2 + 2) / (3xn2 - 6xn) ) [n ≥ 0]
위의 식에 n = 0을 대입하면 다음과 같다.
x1 = x0 – ( (x03 - 3x02 + 2) / (3x02 - 6x0) ) = 2.5 – ( ((2.5)3 + 3(2.5)2 + 2) / (3(2.5)2 - 6(2.5)) ) = 2.80000000000
계속해서 n = 1, n = 2, n = 3을 순서대로 대입하면 다음과 같은 추정하려는 각각의 근을 구할 수 있다.
x2 = x1 – ( (x13 - 3x12 + 2) / (3x12 - 6x1) ) = 2.80000000000 – ( ((2.80000000000)3 + 3(2.80000000000)2 + 2) / (3(2.80000000000)2 - 6(2.80000000000)) ) = 2.73571428571
x3 = x2 – ( (x23 - 3x22 + 2) / (3x22 - 6x2) ) = 2.73571428571 – (((2.73571428571)3 + 3(2.73571428571)2 + 2) / (3(2.73571428571)2 - 6(2.73571428571)) ) = 2.73206237348
x4 = x3 – ( (x33 - 3x32 + 2) / (3x32 - 6x3) ) = 2.73206237348 – (((2.73206237348)3 + 3(2.73206237348)2 + 2) / (3(2.73206237348)2 - 6(2.73206237348)) ) = 2.73205080768
x5 = x4 – ( (x43 + 2x42 - 1) / (3x42 + 4x4) ) = 2.73205080768 – ( ((2.73205080768)3 + 2(2.73205080768)2 - 1) / (3(2.73205080768)2 + 4(2.73205080768)) ) = 2.73205080757
실제 근 α
= 2.73205080757와 추정한 결과를 비교해보니 x5 값이 실제 근과 일치한다.
Verification using SAGE:
Code:
#Use a loop to compute iterations of
Newton-Raphson's Method
x = var('x')
f(x) = x^3 - 3*x^2 + 2
fp = diff(f,x)
NewtonIteration(x) = x - (f/fp)(x)
xn = 2.5;
print('x0 =', xn);
for i in range(10):
xn =
N(NewtonIteration(xn),digits=12);
print('x', i+1, '=',
xn);
print
print("This is the exact answer for
comparison: ")
print(solve(f(x)==0, x))
print
print("Note that, we have been
trying to estimate the postive root, which is sqrt(3) + 1 ≈
2.73205080757")
Output:

Additional verification using Sage Grapher for
Newton's Method:
. ■
Comment: I tried to show additionally
several methods of derivation of Newton's Method using tangent line properties.
I also gave an example of using Newton's Method manually and using SAGE.
참고문헌:
[1] Paul Dawkins.,
(2020), “Newton’s Method”, Paul’s Online Notes,
URL: https://tutorial.math.lamar.edu/classes/calci/newtonsmethod.aspx
[2] Ardian Umam.,
(2017), “Newton’s Method Optimization:
Derivation and How It Works”,
ardianumam/worldpress,
URL: https://ardianumam.wordpress.com/2017/09/27/newtons-method-optimization-derivation-and-how-it-works/
[3] Claude Leibovici., (2018), “Proof of the Newton Raphson
method”, Stack Exchange,
URL: https://math.stackexchange.com/questions/2771991/proof-of-the-newton-raphson-method
For 실습:
http://matrix.skku.ac.kr/Mobile-Sage-G/sage-grapher-newton_method.html
[Final OK by SGLee] [HW 4] 연습문제
풀기 및 Re-Finalized by 유가이 올렉산드르, AI 을 위한 기초수학 16강 <미분적분학> [Gradient descent Algorithm] 개념 복습 및 정리 by 손원식, 추가 comment by 임성규, 이상구 교수님, 천가영
[HW 4] 연습문제 풀기 및 Finalized by 유가이 올렉산드르, AI 을 위한 기초수학 16강 <미분적분학> [Gradient descent Algorithm] 개념 복습 및 정리 by 손원식, 추가 comment by 임성규, 이상구 교수님, 천가영
Article by 손원식
Finalized by 손원식
Comments by 손원식, 임성규, 이상구 교수님, 천가영
추가 내용 및 Re-Finalized by 유가이 올렉산드르
I. Gradient Descent
Algorithm (경사-기울기 하강법, 傾斜下降法)
► 개요: Gradient
Descent Algorithm은 어떤 모델에 대한 비용(Cost)를 최소화 시키는 알고리즘으로써, 머신러닝 및 딥러닝 모델에서 사용되는 가중치의 최적해를 구할 때 널리 쓰이는 알고리즘이다. 기본 개념은 함수의 기울기(경사)를 구하여 기울기가 낮은 쪽으로 계속 이동시켜서 극값에 이를 때까지 반복시키는 것이다.
► Key Idea 2: 이제 제약조건이 없는 최적화(unconstrained
optimization) 문제
![]()
를 푸는 경사하강법(gradient
descent method)에 대하여 살펴보자.
► [Fermat의 임계점 정리]에 의해 위 문제의 최적해(optimal
solution)
는 다음을 만족한다.
![]()
따라서 2.4절에서 배운 바와 같이 방정식
을 풀어서 나온 해들이 최적해가 되는지 판단하면 된다.
그러나 함수
가 비선형인 경우는 방정식을 풀어서 임계점을 구하는 것조차도 쉽지 않다. 이런 경우에는 수치적인 방법으로 임계점을 구한다. 최적화문제를 푸는 계산방법은 대개 반복법(iterative method)으로, 초기 근사해
으로부터 시작하여 특정한 반복단계를 거쳐 이전보다 나은 근사해
,
, ... 를 생성한다. 목표는
번째 근사해
또는 극한값
에서
을 만족하도록 하는 것이다.
●
번째 반복단계는 보통 다음과 같은 (직선의 벡터방정식) 형식으로 구성된다.
![]()
여기서
는 탐색방향(search direction),
는 step-size (머신러닝에서는 이를 learning rate)라 한다. 즉
상에서
방향으로
만큼 이동하여
을 생성한다.
● Remark: 보통
는 함수값이 감소하는 방향으로 정한다. 즉 다음을 만족한다.
![]()
이러한
는 특히 하강방향(descent
direction)이라고도 한다.
방향을 따라 움직이면 함수
가 감소한다는 보장이 있으므로 step-size
는
이 만족되도록 정한다.
► step-size
를 택하는 방법은 대개 다음 두 가지로 나눌 수 있다.
① 반직선
(
) 상에서 함수
의 값이 가장 작게 되는
를 찾는다.
![]()
이 방법을 exact line search라 하고, 이때의
를 optimal step-size라 한다. 대개는 cost가 많이 들어서 잘 사용되지 않는다.
② 만일
을 정확하게 풀지는 않지만 함숫값이 충분히 감소한다는 것을 보장하는
를 선택하는 방법이 있다면, exact line search를 피하여 cost를 상당히 줄일 수 있다. 이 방법을 inexact
line search 라 한다. 즉, 다음 조건을 만족하는
를 찾는다.
![]()
여기서
이다. 이를 그림으로 표현하면 다음과 같다.

따라서 위의 두 부등식을 만족하는
는 폐구간
에서 택하면 된다.
[참고]
가 만족해야 하는 조건은 여러 가지가 있으나, 위의 두 부등식이 주로 쓰인다. 이를 Wolfe condition이라 하고, 그 중 첫 번째 부등식을 특히 Armijo condition이라 한다.
► 경사하강법(gradient descent method)은 탐색방향을
로 택하는 경우이다. 앞서 살펴본 바와 같이 음의 그래디언트
방향이 점
에서
가 가장 가파르게 하강하는 방향이므로, 경사하강법 방법의 아이디어가 쉽게 이해된다. (스키장에서 가장 빠르게 하강하는 길을 찾는 알고리즘의 아이디어와 일치한다) 경사하강법은 모든 차원과 모든 공간에서의 적용이 가능하다. 심지어 무한차원 벡터함수에도 쓰일 수 있다. (이 경우 해당 차원이 만들어내는 공간을 함수공간(function space)이라고 한다. 벡터공간을 일반화 하는 함수공간은 모두 수렴의 개념을 갖춘 선형공간(linear space)으로서, 수렴의 개념을 Norm에 입각한 거리에 의해 정한 Banach공간 또는 Hilbert공간인 경우가 많으나, 보다 일반적인 선형위상공간도 포함한다.) 다음은 경사하강법의 알고리즘이다.
► [경사하강법] (
의 의미는
같이
이 1 보다 아주 작다는 의미이다.)
[단계 1] 초기 근사해
와 허용오차(tolerance)
을 준다.
이라 한다.
[단계 2]
를 계산한다. 만일
이면, 알고리즘을 멈춘다.
[단계 3] line search를 수행하여 적절한 step-size
를 구한다.
[단계 4]
,
라 두고 [단계 2]로 이동한다.
►다음은 주어진 함수에 경사하강법을 적용한 예시이다. 허용오차는
으로 주었다 [2].
,
, ![]()
여기서
이고,
는 Hessian
가 양의 정부호(positive definite)인 이차함수이므로 exact line search를 수행하면,
는 다음과 같이 closed-form으로 나온다.
Solution
using SageMath:
Code:
# initializing
A = diagonal_matrix(RR,
[20, 10, 2, 1])
b = vector(RR, [1, 1, 1,
1]) # objective function
x0 = vector(RR, [0, 0,
0, 0]) # initial guess
g0 = -b # initial gradient
r = [] # 그래프를 그리기 위한 용도
# main iteration
for i in range(0, 200):
gn = g0.norm()
r.append((i, gn))
if gn <
10^(-8):
print("Stationary
point! Algorithm terminated!")
break
w = A*g0
a =
g0.inner_product(g0)/(g0.inner_product(w)) # step-size
x1 = x0-a*g0
g1 = A*x1-b
x0 = x1;g0 = g1
show(line2d(r) + point(r, color = 'red')) # gradient 의 norm을 그래프로 그림
Output:

Note that,
위의
그래프에서
이 점차 0에 수렴함을 쉽게 확인할 수 있다.

[경사하강법의 iterative 단계(빨간색)]
► [경사하강법은 탐색방향을 현재의 위치
의 근방에서 가장 가파르게 하강하는 방향
로 사용한다. 그러나 이 경우 그림의 빨간색 경로와 같이 해 근처에서 zigzag 현상이 발생하여 마지막 단계에서 수렴속도가 많이 늦어진다.
이를 보완하여 Conjugate Gradient Method(CGM, 공액경사법, 켤레기울기법)은
와 이전의 방향
를 조합하여 새 탐색방향
으로 사용한다. (녹색)]
► 뉴턴 방법(Newton’s
method)은 탐색방향을
로 택하는 경우를 말한다. 왜냐하면
근방에서
는 다음의 이차함수를 이용하여 근사화 할 수 있기 때문이다.
![]()
따라서
에서
로 진행하기 위하여,
최적화 문제
![]()
의 최적조건으로부터
를 얻을 수 있다.
![]()
이다.
► 다음은 뉴턴 방법(Newton’s
method)의 알고리즘(Algorithm)이다.
[뉴턴 방법(Newton’s method)]
[단계
1] 초기 근사해
과 허용오차(tolerance)
을 준다.
이라 한다.
[단계
2] 만일
이면, 알고리즘을 멈춘다.
[단계
3]
를 계산한다.
[단계
4]
라 두고 [단계 2]로 이동한다.
● Remark:
이 양의 정부호(positive definite) 행렬이면, 역행렬
도 양의 정부호 행렬이므로, 뉴턴 방법의 탐색방향
역시 하강방향(descent
direction)이 된다. 즉
![]()
이다. 따라서
방향으로 진행하면 함수값이 감소함을 알 수 있다.
● Note: 그러나 뉴턴 방법은 헤시안을 계산해야 하므로, 변수
이 큰 함수의 경우 헤시안을 계산하는 데 많은 연산이 필요하여 효과적이지 않을 수 있다. 그리고 초기 근사해
이 문제의 해
의 근방에 있어야만 뉴턴 방법이 수렴한다는 보장이 있으나, 이는 미리 알 수 없으므로 실제 뉴턴 방법을 적용할 때는 step-size
도 같이 고려한다.
즉 적절한
line search를 동반한다.
그 후
을 계산한다.
![]()
● 이외에도
를 택하는 방법에 따라 quasi-Newton
method, conjugate gradient
method 등이 있다.
------------------------------------------------
학습한 내용 정리
by 손원식:
경사 하강법 [3]
►General
Definition: 경사 하강법(傾斜下降法, Gradient
descent)은 1차 근삿값 발견용 최적화 알고리즘이다. 기본 개념은 함수의 기울기(경사)를 구하여 기울기가 낮은 쪽으로 계속 이동시켜서 극값에 이를 때까지 반복시키는 것이다.
● About contents:
최적화할 함수 에 대하여,
먼저 시작점 를 정한다.
현재 가 주어졌을 때, 그 다음으로 이동할 점인 은 다음과 같이 계산된다.
이때 는 이동할 거리를 조절하는 매개변수이다.
이 알고리즘의 수렴 여부는 f의 성질과 의 선택에 따라 달라진다.
또한, 이 알고리즘은 지역 최적해로 수렴한다.
따라서 구한 값이 전역적인 최적해라는 것을 보장하지 않으며 시작점 의 선택에 따라서 달라진다.
이에 따라 다양한 시작점에 대해 하강법을 적용하여 그 중 가장 좋은 결과를 선택할 수도 있다.
평가 및 장단점 [3]
► 경사 하강법은 모든 차원과 모든 공간에서의 적용이 가능하다.
심지어
무한 차원상에서도 쓰일 수 있다. (이 경우 해당 차원이 만들어내는 공간을 함수 공간이라고 한다.)
정확성을 위해서 극값으로 이동함에 있어 매우 많은 단계를 거쳐야하며,
주어진
함수에서의 곡률에 따라서 거의 같은 위치에서 시작했음에도 불구하고 완전히 다른 결과로 이어질 수도 있다.
► Additional material 1:
Question) --> Gradient descent Algorithm, 경사 하강법이 쓰이는 본질적인 이유
Answer) 목적함수와 관련이 있기 때문이다!!
그렇다면
목적함수란 무엇인가?
목적함수 [4]
► Definition: 목적함수란 단어 그대로 어떤 목적을 위하여 사용하는 함수를 말한다. 일반적으로 함수의 최댓값 또는 최솟값을 구할 때, 그 함수를 목적함수라고 한다. 최적화 문제를 다룰 때 주로 언급된다.
● 추가 정의: 어떤 집합
에서 실수로 가는 함수 ![]()
![]()
![]()
![]()
의 최댓값이나 최솟값을 구하려 할 때,
를 목적함수라고 한다.
Note: 사용되는 분야에 따라서 표현이 달라지기도 하는데, 경제학의 경우 비용 함수(cost function)라고도 하며, 물리학의 경우에는 에너지 함수(energy function)라고 하기도 한다.
* 기울기 하강법 *
목적함수의 최댓값과 최솟값을 구하는 방법은 다양하게 존재한다. 그중에 기울기 하강법(steepest descent method)이라고 하는 방법이 있는데, 이는 임의의 함수에 대한 극솟값을 찾는 방법이다.
► Additional material 2:
머신러닝의 기초 : 경사하강법
우선 머신러닝의 간단한 정의에 대해서 알아보자.
● Definition (머신러닝): 인간의 학습능력과 같은 기능을 컴퓨터에서 실현하고자 하는 기술 및 기법을 말한다.
** 경사하강법은 이러한 머신러닝(machine learning)의 기초가 된다. **
● 선형회귀와 경사 하강법의 관계를 간단하게 살펴보도록 하자.
선현회귀의 목표는 입력테이터(x)와 타깃테이터(y)를 통해 기울기 (a, 가중치)와 절편(b)를 찾는 것이다.
(단, 조건에서 입력데이터와 타깃데이터는 주어진 상황이다.)
경사하강법은 모델이 데이터를 잘 표현할 수 있도록 기울기(즉, 변화율)을 사용하여 모델을 조금씩 조정하는 최적화된 알고리즘이다.
● 모델의 예시: y_hat(예측값)
= wx + b
--------------------------------------------------------------------------
연습문제 by 유가이 올렉산드르: Let’s try to find the local minimum of the function manually and using Python.
f(x) = x / (x2 + 1)
Solution
f’(x) = (x2 +
1) – (x)(2x) / (x2 + 1)2
f’(x) = (-x2 +
1) / (x2 + 1)2
Now, find the
inputs where f’(x) = 0
-x2 +
1 = 0
x2 =
1
x = 1, -1
Therefore,
Local Minima is
at x = -1
Local Maxima is at x = 1
Verification using Python
(Graph for Minima and Maxima + Gradient Descent method to find local minimum of
the function with the derivative):
Python Code:
#Graph.
import
matplotlib.pyplot as plt
import numpy as
np
x =
np.linspace(-2, 2, 41)
y = x / (x**2 +
1)
plt.grid()
plt.axis("equal")
plt.plot(x, y)
plt.plot(-1,
-0.5, 'bo-')
plt.text(-1.4,
-0.3,'Local Minimum')
plt.plot(1, 0.5,
'bo-')
plt.text(0.6,
0.2, 'Local Maximum')
plt.show()
#Gradient Descent method to find local minimum of the
function with the derivative
#Given function
is f(x) = x / (x2 + 1)
#The derivative
of this function is f'(x) = f’(x) = (-x2 + 1) / (x2 + 1)2
cur_x = 0 # The
algorithm starts at x = 0
gamma = 0.01 #
Learning rate
precision =
0.000001 #This tells us when to stop the algorithm
previous_step_size
= 1
max_iters = 10000
# maximum number of iterations
iters = 0
#iteration counter
df = lambda x:
(-x**2 + 1) / ((x**2 + 1)**2) #Gradient of our function
while previous_step_size
> precision and iters < max_iters:
prev_x = cur_x #Store current x value in prev_x
cur_x -= gamma * df(prev_x) #Grad descent
previous_step_size = abs(cur_x - prev_x) #Change in x
iters = iters+1 #iteration count
print("Iteration",iters,"\nX value is",cur_x) #Print
iterations
print("The
local minimum occurs at", cur_x)
Output:
Graph of the function f(x) = x / (x2 +
1)

Gradient Descent method to find local minimum of the function (in the figure below I showed only the last 7
iterations):
. ■
Note that, I decided to
do 10,000 iterations, but the algorithm runs for 1506 iterations before it
terminates. Because, the code was programmed to stop the loop when
difference between x values from 2 consecutive iterations is less than 0.000001
or when number of iterations exceeds 10,000.
참고문헌:
[1] http://matrix.skku.ac.kr/math4ai/part2/
[2] J.
Barzilai 와 J. M. Borwein, Two-Point Step Size
Gradient Methods, IMA J. Numer. Anal. (1988) 8 (1): 141-148.
[3] https://ko.wikipedia.org/wiki/%EA%B2%BD%EC%82%AC_%ED%95%98%EA%B0%95%EB%B2%95
[4] https://terms.naver.com/entry.nhn?docId=3405075&cid=47324&categoryId=47324
-------------------------------------------------------------------------------------
● COMMENTS:
Comment by 손원식: 예전부터 선형성이란 개념에 대해서 흥미를 가지고
있었다. 학창시절에 조던 엘렌버그라는 저자가 쓴 '틀리지 않는 법'이란 책을 읽었다.
그 책에서는
바로 첫번째 장부터 선형성이라는 개념을 언급한다. 경제와 관련하여 '덜
스웨덴 스러움'이라는 용어를 말하며, 이와 연관된 역사의 흐름, 자유 시장의 번영을 위한 노력이 언급된다. 선형성과 비선형성에 대해서 흥미로움을
갖고 있었고, 이에 대한 개념을 더 알고 싶었다.
정말 운이 좋게도, 이번 4주차 강의에서 이를 자세히
다루는'경사 하강법'이란 개념을 구체적으로 배우고 응용해보면서 지식을
넓히고 내가 흥미를 가진 분야를 공부할 수 있는 좋은 기회였다.
단순히 개념만
숙지하고 이와 관련된 몇몇개의 문제를 푼 것만이 아닌, 이와 관련된 머신러닝이라는 개념을 스스로 찾아보며
알게 되었다.
이를 통해서, 내가 이 강의를 듣는 목적을 다시 한번 깨달을 수 있는 좋은 기회였다.
내가 생각하기에
이 강의는 인공지능을 보다 쉽게 이해하기 위해서 이를 구성하고 있는 가장 기본적이고 핵심적인 '수학'을 배우는 것이다.
결론적으로
우리는 인공지능에 관한 지식을 익혀야한다. 따라서 교수님께서 설명해주시는 수학적 기본 지식들은 당연히 익히며, 이와 더불어 인공지능과 관련된 지식을 쌓기 위해 노력하고 있다.
Comment by 유가이 올렉산드르: 손원식 학우님, thanks for the nice summarization of the material about the Gradient Descent algorithm.
In short, gradient descent is a method for finding the minimum value of a loss function (there are many types of this function). Minimizing any feature means looking for
the “deepest cavity” in that feature. Keep in mind that the function is used to
control error in the predictions of a machine learning model. Finding the
minimum means getting the smallest possible error or improving the accuracy of
the model. We increase the accuracy by iterating over the training dataset
while adjusting the parameters of our model (weights and biases).
So, gradient descent is needed to minimize the loss
function.
The essence of the algorithm is the process of
obtaining the smallest error value.
I think this is a very important topic in the data
optimization section, and also, using this algorithm you can find an
approximate value of the local minimum of the function, for example, as shown
in the example above.
임성규(2015****08)8월 7일 오후 11:58
저도 올해 머신러닝에 대한 책을 읽으면서 선형회귀에 대하여 알게되었습니다. 글을 읽으며 경사하강법에 대해 한번 더 복습하였고, 머신러닝의 선형회귀분석방법에 어떻게 사용되는지 생각해보았습니다. 선형회귀분석에서 대표적인 손실함수로 평균제곱오차(MSE)가 있는데 실제 데이터값과 예측 데이터 차이값을 제곱한 것들의 평균입니다. 이 오차가 작을수록 선형회귀분석의 정확도는 올라가게 됩니다. 그리고 이 손실함수를 최소화하는 방향으로 가기위하여 기울기를 사용하여 모델을 조금씩 조정하는데 경사하강법 알고리즘이 사용됩니다. 글 잘읽었습니다. ^^
이상구(LEE SANGGU)8월 8일 오전 1:27
본 강좌의 의도를 이해 했으니 ...
A 입니다^^
천가영(2020****17)8월 8일 오전 11:50
경사하강법이 왜 필요한지 궁금했었는데 이 글 덕분에 확실히 이해하게 되었습니다. 목적함수라는 개념을 처음으로 배웠고 머신러닝과 경사하강법의 관계에 대해서도 알 수 있게 되었습니다. 감사합니다!
Newton's Method에 대한 질문, 질문 by 한수현, 답 by 유가이 올렉산드르, 이상구 교수님

이는 경사하강법 파트에 나온
Newton's method에 대한 설명이고,

이는 미분의 응용 파트에서 나온 Newton's method에 대한 설명입니다.
두 설명 모두 Newton's method라고 하는 것을 보면, 각각이 결국 같은 방식을 이용하여 원하는 근사값을 구한다는 의미로 보입니다.
하지만 저는 저 두 내용이 완전히 관련 없는 독립된 내용으로 느껴집니다.
그래서 저