Description
1. Let
f(x) = 1
2a
log
x − a
x + a
+ b
where a > 0 and b are constants, log denotes the natural logarithm, and | · | denotes the
absolute value.
a) What is the domain of f(x)?
The largest possible domain for f is D = R\{−a, a} since | · | ≥ 0 ∀x ∈ R and the real
valued log function log(y) may be defined sensibly only for y > 0.
b) Compute f
0
(x).
First we show for u : D ⊂ R −→ R, that wherever |u(x)| is differentiable, its derivative
is given by u(x)u
0
(x)
|u(x)|
:
d
dx|u(x)| =
d
dx
p
(u(x))2 =
1
2
p
(u(x))2
2u(x)u
0
(x) = u(x)u
0
(x)
|u(x)|
.
Using this we have
f
0
(x) = 1
2a
x + a
x − a
x−a
x+a
x+a−(x−a)
(x+a)
2
x−a
x+a
=
1
2a
|(x + a)
2
|
|(x − a)
2
|
2a(x − a)
(x + a)
3
=
1
x
2 − a
2
(x 6= ±a).
c) Evaluate the indefinite integral
Z
1
x
2 − 2x
dx
by completing the square.
Z
dx
x
2 − 2x + 1 − 1
=
Z
dx
(x − 1)2 − 1
(x − 1 = secθ =⇒ dx = secθtanθdθ)
=
Z
secθtanθdθ
sec2θ − 1
=
Z
secθdθ
tanθ
=
Z
cscθdθ
= −log|cscθ + cotθ| + c (∗)
= −log
x − 1
√
x
2 − 2x
+
1
√
x
2 − 2x
+ c
= log
p
x(x − 2)
x
+ c
= log|
p
x(x − 2)| − log|x| + c
=
1
2
(log|x| + log|x − 2|) − log|x| + c
=
1
2
(log|x − 2| − log|x|) + c.
(*) Here we used a standard integral list found at https://en.m.wikipedia.org/wiki/ .
2. Let D be the region in the xy-plane bounded by the parabolas y = 2x
2 and y = 1 + x
2
and satisfying |x| < 1.
a) Sketch the region D.
b) Evaluate the definite integral
Z Z
D
x
2
dA =
Z 1
−1
Z 1+x
2
2x2
x
2
dy dx =
Z 1
−1
x
2
y
1+x
2
2x2 dx =
Z 1
−1
x
2−x
4
dx =
x
3
3
−
x
5
5
1
−1
=
4
15
.
3. ** For problems 3 and 4 I have included in this document snippets of R code used for
each problem. However, I have also attached all the code collected together in a seperate
document submitted as well to possibly assist in grading.**
Let
A =
1 4
2 5
3 6
and b =
1
2
3
.
a) Is the sum A + b defined? If so, what is it?
The sum A + b is defined in the R programming language (but we note that this sum
is not defined in standard linear algebra or in some other programming languages such
as Matlab). In R the sum is:
A + b =
2 5
4 7
6 9
.
b) Write one line of R code that uses the cbind function to create the matrix A and
assigns it to a variable named A.
This is accomplished with the command : A <- cbind(c(1,2,3),c(4,5,6))
c) Create the vector b using the command b <- 1:3 and compute the sum C <- A + b.
Give an expression for C[i, j] in terms of A[i, j] and b[i].
Creating b as described and using A as before to compute the sum C <- A + b we have
C[i,j] = A[i,j] + b[i].
4. R exercises: these exercises are meant to give you some practice subsetting vectors, reading
R documentation files, and loading R packages.
a) Among R’s built-in constants is a vector named letters that contains 26 lowercase
letters in alphabetical order. Spell your last name by subsetting letters (spaces, if
any, should be omitted).
my last name <- letters[c(10,15,8,14,19,15,14)]
b) Read the documentation for letters. Use the c function and one or more components
from another built-in constants vector to capitalize your last name appropriately.
my last name capitalized <- c(LETTERS[10],letters[c(15,8,14,19,15,14)])
c) Repeat part ii for your first name.
my first name capitalized <- c(LETTERS[4],letters[c(1,14,5)])
d) Use the paste function to write your first and last name (correctly capitalized) as a
single character string.
my full name <- paste(c(paste(my first name capitalized,collapse=""),
paste(my last name capitalized,collapse = "")),collapse = " ")
e) Use a logical vector to extract the first and last 5 letters from letters.
x <- 1:26
letters subset <- letters[x[x < 6 | x > 21]]
f) The MASS package contains a vector named chem. Write one line of R code that
returns the number of components of chem that are in the interval (3, 4).
chem components in range <- length(chem[chem > 3 & chem < 4])