HW0_solutions (1)
.pdf
keyboard_arrow_up
School
University of California, Los Angeles *
*We aren’t endorsed by this school
Course
M146
Subject
Computer Science
Date
Jan 9, 2024
Type
Pages
7
Uploaded by phanta_ch
CS M146: Introduction to Machine Learning
UCLA Fall Quarter 2023
Prof. Aditya Grover
Release: 28 Sep 2023
Homework 0
Due: 5 Oct 2023, Thursday, before 11:59 pm
Except for the programming questions, you should be able to solve these problems by hand.
Problem 1
(Multivariate Calculus)
Consider
y
=
x
sin(
z
)
e
−
x
. What is the partial derivative of
y
with respect to
x
?
Solution:
∂y
∂x
= sin(
z
)
(
−
xe
−
x
+
e
−
x
)
= (1
−
x
) sin(
z
)
e
−
x
Problem 2
(Linear Algebra)
(a) Consider the matrix
X
and the vectors
y
and
z
below:
X
=
2
4
1
3
y
=
1
3
z
=
2
3
i. What is the inner product
y
T
z
?
Solution:
y
T
z
= 1
·
2 + 3
·
3 = 11
ii. What is the product
X
y
?
Solution:
X
y
=
2
·
1 + 4
·
3
1
·
1 + 3
·
3
=
14
10
iii. Is
X
invertible? If so, give the inverse; if not, explain why not.
Solution:
det(
X
) =
2
·
3
−
4
·
1 = 2
̸
= 0 so
X
is invertible.
For a 2
×
2 matrix,
A
−
1
=
a
b
c
d
−
1
=
1
det(
A
)
d
−
b
−
c
a
=
1
ad
−
bc
d
−
b
−
c
a
.
Thus,
X
−
1
=
1
2
3
−
4
−
1
2
.
1
iv. What is the rank of
X
?
Solution:
The rows (or equivalently, columns) of
X
are
linearly independent, so rank(
X
) = 2.
(b)
Vector Norms
[4 pts]
Draw the regions corresponding to vectors
x
∈
R
2
with following norms (you can hand draw
or use software for this question):
Solution:
Each
l
p
-norm corresponds to a unit ball. In
R
2
, this corresponds to a disc of diameter 2 centered at the origin.
i.
||
x
||
2
≤
1 (Recall
||
x
||
2
=
q
∑
i
x
2
i
.)
Solution:
the unit circle (origin-centered circle
with diameter of 2), and its interior
ii.
||
x
||
0
≤
1 (Recall
||
x
||
0
=
∑
i
:
x
i
̸
=0
1.)
Solution:
the axes
iii.
||
x
||
1
≤
1 (Recall
||
x
||
1
=
∑
i
|
x
i
|
.)
Solution:
origin-centered diamond with diameter
of 2, and its interior
iv.
||
x
||
∞
≤
1 (Recall
||
x
||
∞
= max
i
|
x
i
|
.)
Solution:
origin-centered square with side
length of 2, and its interior
(c)
Matrix Decompositions [6 pts]
i. Give the definition of the eigenvalues and the eigenvectors of a square matrix.
Solution:
An
eigenvector
of a square matrix is a vector that points in a direction that is invariant
under the associated linear transformation. In other words—, if
v
is a vector that is not
zero, then it is an eigenvector of a square matrix
A
if
A
v
is a scalar multiple of
v
. This
condition could be written as the equation
A
v
=
λ
v
,
where
λ
is a number (scalar) known as the
eigenvalue
associated with the eigenvector
v
.
ii. Find the eigenvalues and eigenvectors of
A
=
2
1
1
2
.
Solution:
The eigenvectors
v
of this transformation satisfy the equation
A
v
=
λ
v
.
Rearrange this equation to obtain (
A
−
λ
I
)
v
= 0, which has a solution only when its
determinant
|
A
−
λ
I
|
equals zero. Set the determinant to zero to obtain the polynomial
equation,
p
(
λ
) =
|
A
−
λ
I
|
= (2
−
λ
)
2
−
1 = (
λ
2
−
4
λ
+ 4)
−
1 =
λ
2
−
4
λ
+ 3 = (
λ
−
3)(
λ
−
1) = 0
,
known as the characteristic polynomial of the matrix
A
. In this case, it has the roots
λ
= 1 and
λ
= 3.
For
λ
= 1, the equation becomes,
(
A
−
I
)
v
=
1
1
1
1
v
1
v
2
=
0
0
,
which has the solution,
v
=
1
−
1
.
2
For
λ
= 3, the equation becomes,
(
A
−
3
I
)
w
=
−
1
1
1
−
1
w
1
w
2
=
0
0
,
which has the solution,
w
=
1
1
.
Thus, the vectors
v
and
w
are eigenvectors of
A
associated with the eigenvalues
λ
= 1
and
λ
= 3, respectively.
iii. For any positive integer
k
, show that the eigenvalues of
A
k
are
λ
k
1
, λ
k
2
, . . . , λ
k
n
, the
k
th
powers of the eigenvalues of matrix
A
, and that each eigenvector of
A
is still an eigen-
vector of
A
k
.
Solution:
We will prove by induction.
Base case (given):
A
v
=
λ
v
Inductive step: Prove that if
A
k
v
=
λ
k
v
, then
A
k
+1
v
=
λ
k
+1
v
.
This holds because
A
k
+1
v
=
A
(
A
k
v
)
=
A
(
λ
k
v
)
=
λ
k
(
A
v
) =
λ
k
+1
v
.
Since both the basis and the inductive step have been performed, by mathematical
induction, the statement
A
k
v
=
λ
k
v
holds for all positive integer
k
. Q.E.D.
(d)
Vector and Matrix Calculus [5 pts]
Consider the vectors
x
and
a
and the symmetric matrix
A
.
i. What is the first derivative of
a
T
x
with respect to
x
?
Solution:
Let
a
i
and
x
i
denote the elements of
a
and
x
, respectively. Then
f
(
x
) =
a
T
x
=
∑
n
i
=1
a
i
x
i
so
∂f
(
x
)
∂x
k
=
∂
∂x
k
∑
n
i
=1
a
i
x
i
=
a
k
and
∇
x
a
T
x
=
a
.
ii. What is the first derivative of
x
T
A
x
with respect to
x
? What is the second derivative?
Solution:
Let
a
ij
denote the element in row
i
, column
j
of
A
. Then
f
(
x
) =
x
T
A
x
=
∑
n
i
=1
∑
n
j
=1
x
i
a
ij
x
j
so
∂f
(
x
)
∂x
k
=
∂
∂x
k
n
X
i
=1
n
X
j
=1
a
ij
x
i
x
j
=
∂
∂x
k
X
i
̸
=
k
X
j
̸
=
k
a
ij
x
i
x
j
+
X
i
̸
=
k
a
ik
x
i
x
k
+
X
j
̸
=
k
a
kj
x
k
x
j
+
a
kk
x
2
k
= 0 +
X
i
̸
=
k
a
ik
x
i
+
X
j
̸
=
k
a
kj
x
j
+ 2
a
kk
x
k
=
n
X
i
=1
a
ik
x
i
+
n
X
j
=1
a
kj
x
j
= 2
n
X
i
=1
a
ki
x
i
where the last equality follows from
a
ij
=
a
ji
. Note that the
k
th
entry of
∇
x
f
(
x
) is just
the inner product of the
k
th
row of
A
and
x
; therefore,
∇
x
x
T
A
x
= 2
A
x
.
To find the second derivative,
∂
2
f
(
x
)
∂x
k
x
ℓ
=
∂
∂x
k
∂f
(
x
)
∂x
ℓ
=
∂
∂x
k
"
2
n
X
i
=1
a
ℓi
x
i
#
= 2
a
ℓk
= 2
a
kℓ
Therefore,
∇
2
x
x
T
A
x
= 2
A
.
3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Suppose that a parachutist with linear drag (m=50 kg, c=12.5kg/s) jumps from an airplane flying at an altitude of a kilometer with a horizontal velocity of 220 m/s relative to the ground.
a) Write a system of four differential equations for x,y,vx=dx/dt and vy=dy/dt.
b) If theinitial horizontal position is defined as x=0, use Euler’s methods with t=0.4 s to compute the jumper’s position over the first 40 s.
c) Develop plots of y versus t and y versus x. Use the plot to graphically estimate when and where the jumper would hit the ground if the chute failed to open.
arrow_forward
Solve all with correct answer please
arrow_forward
The flight of a model rocket can be modeled as follows. During the first 0.15 s the rocket is propelled upward by the rocket engine with a force of 16 N. The rocket then flies up while slowing down under the force of gravity. After it reaches the apex, the rocket starts to fall back down. When its downward velocity reaches 20 m/s, a parachute opens (assumed to open instantly), and the rocket continues to drop at a constant speed of 20 m/s until it hits the ground. Write a program that calculates and plots the speed and altitude of the rocket as a function of time during the flight.
SOLVE WITH MATLAB PLEASE
arrow_forward
Advanced and computer programming.
arrow_forward
The graph shows the temperature T, in degrees Fahrenheit, of molten glass t seconds after it is removed from a kiln.
(0, 1500)
75
t
(a) Find
lim T.
oF
What does this limit represent?
| This is the natural temperature of glass.
This is the initial rate at which the glass is cooling.
O This is the temperature of the kiln.
This is the temperature of the room.
(b) Find lim T.
oF
What does this limit represent?
O This is the natural temperature of glass.
This is the initial rate at which the glass is cooling.
This is the temperature of the kiln.
This is the temperature of the room.
arrow_forward
A circle in the XY-coordinate system is specified by the center coordinates (x, y) and radius (r). Read the values for 2 circles- x1, y1, r1 for C1 and x2, y2, r2 for C2. (i) Determine whether the 2 circles intersect. To solve the problem it suffices to check if the distance between the 2 centers is lesser than the sum of radii of the 2 circles. (ii) Find the smallest circle that encloses the two circles and return its center coordinates and radius.
programming language - c
arrow_forward
(a) A point D is in the interior of angle ZBAC provided that D and C are on the
same side of line AB and D and B are on the same side of line AC.
(b) A point D is in the interior of angle ZBAC provided that there exist points E
and F on rays AB and AC, respectively, such that E * D* F.
Can we use Hilbert's Axioms to prove (a) implies (b) and (b) implies (a)? Share some
of your explorations. Even if you get stuck, you can share what you tried, why you
tried it, and what obstacles came up.
arrow_forward
I A bob attached to a cord is moved to the right where its vertical position is 1.05 cm above the
equilibrium position and is then given an initial speed of 0.6 m/s. What are the values of the
maximum speed and maximum height reached by the bob? (Take g = 9.8 m/s')
(a) hmax
(b)hmax
=D1.87 cm; tnax
3.44 m/s
(c) hmax
(d) hmax
2.89 cm; Vnax = 0.75 m/s
1.87 cm; max 0.75 m/s
2.89 cm; 1,ax
3.44 m/s
or frequency to 2/:
arrow_forward
A simple pendulum of length L, has a
maximum angular displacement
e_max. At one point in its motion, its
kinetic energy is K = 3 J and its
potential energy is U = 4.2 J. When
the pendulum's angular velocity is
one-fourth its maximum value (0' =
%3D
O'_max/4), then its kinetic energy is:
arrow_forward
Let P be “this book is a non-fiction book” and Q be “the ideas in the book is consistent with physical reality.”
Consider a case where both P and Q are false (e.g. a fantasy novel and an unrealistic phenomenon in the novel) and see whether it makes sense that P→Q is true. [Give an example, i.e., the name of a book and a particular idea in that book]
Explain why it is possible that P→Q is true yet Q is false. [Type your explanation]
arrow_forward
Let E : y2 = x3 + 3x + 4 be an elliptic curve over F37.
(a) Find all the elements of the elliptice curve group.(b) Find the order of the group.(c) Find a primitive element of this group and call it G.(d) Compute [30]G = G ⊕ G ⊕ · · · ⊕ G (addition of 30 many G’s)
kindly help with full explanation. Thank you!
arrow_forward
Control inverted pendulum on the moving cart. Need to solve with help of proportional–derivative controller and move cart so that inverted pendulum keeps stable. Theory should be explained.the solution has to be done in python, please submit the code with a very detailed explanation
arrow_forward
25 please
arrow_forward
NUMERICAL SOLUTIONS (Methods in solving Non-linear equations.)
UPVOTE WILL BE GIVEN. Please write the complete solutions legibly and completely. No long explanation needed. Answer in 2 decimal places.
arrow_forward
13 pl
arrow_forward
Example 7:
Rocket sleds were used to test aircraft and its effects on human subjects at high speeds. It is
consisted of four rockets; each rocket creates an identical thrust T.
Calculate the magnitude of force exerted by each rocket (T)
for the four-rocket propulsion system shown in the Figure.
The sled's initial acceleration is 49 m/s, the mass of the
system is 2100 kg, and the force of friction opposing the
motion is known to be 650 N.
Solution: H.W
Free-body diagram
arrow_forward
6. Two iterative methods for solving linear systems of algebraic equations, Ax = b, are Jacobi
and Gauss-Seidel. For each of these methods give necessary and sufficient conditions on A
so that the method will give the exact answer in one iteration, regardless of b and the starting
value x(0).
arrow_forward
Please work out question 30 and show work for explanation of how you came up with your answer.
arrow_forward
3. The equations of motion of the airplane in a straight line steady symmetrical climb are:
V
md-
dt
=T-D
L-W=0
OT W siny - D= 0
L W cosy 0
V
md- = T
L
-
dt
=
W siny - D
W cos y = 0
arrow_forward
can some one please help me solve this problem and how to do it please. Please show the answer in hadnwritten
arrow_forward
Q4: Write the parametric equation of revolution surface in matrix
form only which generated by rotate a Bezier curve defined by the
coefficient parameter in one plane only, for the x-axis [0,5, 10,4],
y-axis [1,4,2,2] respectively, for u-0.5 and 0 = 45° Note: [the
rotation about y-axis].
arrow_forward
Question 1
Full explainthe this question very fast solution sent me step by step Don't ignore any part all part work u A to CText typing work only not allow paper work
Fast
arrow_forward
Q. Let A = {a, b, c, d, e} and B = {1, 2, 3, 4, 5, 6, 7, 8}. How many functions f : A → B(a) ... are injective?(b) ... are not injective?(c) ... are such that f(a) = f(b) = f(c)?(d) ... are such that exactly three elements of A have 8 as an image?(e) ... are surjective?
arrow_forward
The Green Monster, as shown below, is a wall 37 feet high in left field at Fenway Park in Boston. The wall is 310 feet
from home plate down the third base line. If the batter hits the ball 4 feet above the ground, neglecting air resistance,
determine the minimum speed that the bat must impart to the ball that is hit over the Green Monster.
height above home plate [ft]
200
The equations of motions for the baseball are x(t) = (u cos 0)t and y(t) = y + (u sin 0)t-t² as depicted in the
diagram below. The ball's initial speed is u. The gravitational constant g is 9.8 m/sec². The height at which the ball is
struck is yo.
180
The coordinates depict the geometry with the origin at the home plate. The ball is struck at y = 4 ft. The top of the
Green Monster, which is 310 feet from home plate, is noted as (310,37).
160
140
120
100
80
60
(0,4)
40
(0,0)
Gulf
у
In a well-documented MATLAB script hmwk8Q3.m, using vectorizing methods, plot the five baseball trajectories for the
speeds u = 70, 80, 90,…
arrow_forward
Show that F(x, y, z) = xy + xz + yz has the value 1 if and only if at least two of the variables x, y, and z havethe value 1.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- Suppose that a parachutist with linear drag (m=50 kg, c=12.5kg/s) jumps from an airplane flying at an altitude of a kilometer with a horizontal velocity of 220 m/s relative to the ground. a) Write a system of four differential equations for x,y,vx=dx/dt and vy=dy/dt. b) If theinitial horizontal position is defined as x=0, use Euler’s methods with t=0.4 s to compute the jumper’s position over the first 40 s. c) Develop plots of y versus t and y versus x. Use the plot to graphically estimate when and where the jumper would hit the ground if the chute failed to open.arrow_forwardSolve all with correct answer pleasearrow_forwardThe flight of a model rocket can be modeled as follows. During the first 0.15 s the rocket is propelled upward by the rocket engine with a force of 16 N. The rocket then flies up while slowing down under the force of gravity. After it reaches the apex, the rocket starts to fall back down. When its downward velocity reaches 20 m/s, a parachute opens (assumed to open instantly), and the rocket continues to drop at a constant speed of 20 m/s until it hits the ground. Write a program that calculates and plots the speed and altitude of the rocket as a function of time during the flight. SOLVE WITH MATLAB PLEASEarrow_forward
- Advanced and computer programming.arrow_forwardThe graph shows the temperature T, in degrees Fahrenheit, of molten glass t seconds after it is removed from a kiln. (0, 1500) 75 t (a) Find lim T. oF What does this limit represent? | This is the natural temperature of glass. This is the initial rate at which the glass is cooling. O This is the temperature of the kiln. This is the temperature of the room. (b) Find lim T. oF What does this limit represent? O This is the natural temperature of glass. This is the initial rate at which the glass is cooling. This is the temperature of the kiln. This is the temperature of the room.arrow_forwardA circle in the XY-coordinate system is specified by the center coordinates (x, y) and radius (r). Read the values for 2 circles- x1, y1, r1 for C1 and x2, y2, r2 for C2. (i) Determine whether the 2 circles intersect. To solve the problem it suffices to check if the distance between the 2 centers is lesser than the sum of radii of the 2 circles. (ii) Find the smallest circle that encloses the two circles and return its center coordinates and radius. programming language - carrow_forward
- (a) A point D is in the interior of angle ZBAC provided that D and C are on the same side of line AB and D and B are on the same side of line AC. (b) A point D is in the interior of angle ZBAC provided that there exist points E and F on rays AB and AC, respectively, such that E * D* F. Can we use Hilbert's Axioms to prove (a) implies (b) and (b) implies (a)? Share some of your explorations. Even if you get stuck, you can share what you tried, why you tried it, and what obstacles came up.arrow_forwardI A bob attached to a cord is moved to the right where its vertical position is 1.05 cm above the equilibrium position and is then given an initial speed of 0.6 m/s. What are the values of the maximum speed and maximum height reached by the bob? (Take g = 9.8 m/s') (a) hmax (b)hmax =D1.87 cm; tnax 3.44 m/s (c) hmax (d) hmax 2.89 cm; Vnax = 0.75 m/s 1.87 cm; max 0.75 m/s 2.89 cm; 1,ax 3.44 m/s or frequency to 2/:arrow_forwardA simple pendulum of length L, has a maximum angular displacement e_max. At one point in its motion, its kinetic energy is K = 3 J and its potential energy is U = 4.2 J. When the pendulum's angular velocity is one-fourth its maximum value (0' = %3D O'_max/4), then its kinetic energy is:arrow_forward
- Let P be “this book is a non-fiction book” and Q be “the ideas in the book is consistent with physical reality.” Consider a case where both P and Q are false (e.g. a fantasy novel and an unrealistic phenomenon in the novel) and see whether it makes sense that P→Q is true. [Give an example, i.e., the name of a book and a particular idea in that book] Explain why it is possible that P→Q is true yet Q is false. [Type your explanation]arrow_forwardLet E : y2 = x3 + 3x + 4 be an elliptic curve over F37. (a) Find all the elements of the elliptice curve group.(b) Find the order of the group.(c) Find a primitive element of this group and call it G.(d) Compute [30]G = G ⊕ G ⊕ · · · ⊕ G (addition of 30 many G’s) kindly help with full explanation. Thank you!arrow_forwardControl inverted pendulum on the moving cart. Need to solve with help of proportional–derivative controller and move cart so that inverted pendulum keeps stable. Theory should be explained.the solution has to be done in python, please submit the code with a very detailed explanationarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education