# Tutor profile: Raad A.

## Questions

### Subject: R Programming

Using the preloaded data in R "mtcars": i) Download the data and calculate the average displacement. ii) Construct a linear model where miles per gallon is the response variable, and the displacement and gross horse powers are the explanatory variables. iii) Plot a scatter plot of miles per gallon and displacement and draw a line explaining the relationship between them. iv) Write your conclusions on your linear model.

i) Given that the data is preloaded in R, you can simply type the commands: > data(mtcars) > View(mtcars) >?mtcars Here, we have first downloaded our data to our workspace. Then, we have viewed the data on R. Last, we have requested help to explain the command, and this will give you the idea of the data and the meaning of each variable. ii) A linear model (Regression Model when it comes to Statistics) is creating an equation choosing your $$x$$ and $$y$$ following: $$\hat y=\beta_0+\beta_1X_1+\beta_2X_2$$ y is our response(dependent) variable and x is our explanotory(independent) variable. Now, > OurModel <- lm( mtcars$mpg ~ mtcars$disp + mtcars$hp) iii) We do that by > plot(mtcars$disp,mtcars$mpg,xlab = "Displacement",lab = "Miles Per Gallon") Here, we have drawn a scatter plot and we chose the name of the axis by using xlab and lab. However, scatter plots without any lines or trends can be messy or misleading. So, we will need to type a command AFTER we draw a plot, > line(lm(mtcars$mpg~mtcars$disp)) Now you can see the plot with the trend. iv) When you have chosen a model, the command "summary" outputs many relative pieces of information. > summary(OurModel) From the output, we can see that the displacement is a significant factor of miles per gallon variable. Also, the adjusted $$R^2$$ is close to one which gives that the model is strong and can be liable.

### Subject: Calculus

Q1) integrate the following functions: i) $$ \int \mathrm{ sec x} \mathrm{d}x $$ ii) $$ \int_0^\infty \mathrm{e}^{-y}\mathrm{d}x $$ b) Assume a velocity of a vehicle follows the function $$v(t) = 4t^2 + 3 $$ where $$t$$ is the time in seconds, determine the following: i) The acceleration function. ii) The distance function. iii) The acceleration in 3 seconds. iv) The time spent when the vehicle's speed reached 6 m/s.

Q1)Generally, the integration of random variables raised to powers are simply the variable with a higher power by one and the whole function is divided by the value of the new power. However, when it comes to the power of -1 and any other form, different rules are applied. i) Usually, when dealing with a trigonometric function that can't be integrated directly, we change the form of the function in terms of manageable trigonometric functions and start from there. $$ \int \mathrm{ sec x} \mathrm{d} = \int \mathrm{ sec x}*\frac{secx +tanx}{secx + tanx} \mathrm{dx} $$ if you noticed, we're actually multiplying the equation by 1. $$\int \mathrm{ sec x}*\frac{secx +tanx}{secx + tanx} \mathrm{dx} = \int \frac{sec^2x +secx*tanx}{secx + tanx} \mathrm{dx} $$ Here, we'll apply the substitution method since we have a function and it's derivative in the same problem. So, letting $$ u = secx + tanx$$ and $$du = (secx*tanx + sec^2x)dx $$ Now, our problem became: $$\int \frac{1}{u} \mathrm{du} = ln(u) = ln(secx+tanx) $$ ii) $$dx$$ in an integration problem means with respect to $$x$$. However, the equation here is in terms of $$y$$. So, we treat it as a constant. $$ \int_0^\infty \mathrm{e}^{-y}\mathrm{d}x = \mathrm{xe}^{-y}|_0^\infty$$ The exponential to infinity or negative infinity is actually zero. Now, appying the calculation: $$\mathrm{xe}^{-y}|_0^\infty=0-0=0 $$ Q2) When solving these types of problems, remember the letters in order "d v a". From left to right we differentiate, and we integrate from right to left. This will be explained. i) The acceleration is the derivative of velocity with respect to time. So, $$a(t) = f'(t) = 8t$$ ii) The distance is the integration of velocity with respect to time. So, $$ d(t) = \int v(t) dx = \frac{4}{3}t^3+3t+C$$ iii) plugging in $$t=3$$, we'll have $$a(3)=8*3=24$$ m/s iv) $$v(t) = 4t^2 + 3 = 6$$ $$4t^2=6-3=3$$ $$t^2=0.75$$ $$t=\sqrt(0.75)= ±0.87 = 0.87 seconds$$ We chose the positive value since time spent cannot be negative.

### Subject: Statistics

For the regulations of car plates, let us assume that all the plates contain 3 letters and 3 numbers. Based on this assumption: a-How many possible plates can we possibly have? b-What is the probability that a random plate we choose has exactly 3 A's? c-What is the probability that the number on the random plate is divisible by 2? d-Let's say we keep choosing a plate randomly and the plate with an even number is considered "success", what is the probability that we will need to try 3 times to get our "success"?

a-Given that we have 26 letters of alphabets and 10 possible digits (0-9), every option of a letter has 26 options and 10 for numbers. Now, displaying them as entries with the numbers of options, we'll have: 26 26 26 10 10 10 The total possible outcomes will be the multiplication of these numbers, our result is: $$26*26*26*10*10*10=17576000$$ b-When it comes to frequencies, the probability is always the total outcomes we are seeking divided by all the possible outcomes. So first, let us calculate the number of possible plates with only A's: $$1*1*1*10*10*10=1000$$ Hence, our answer= $$ \frac{1000}{17576000}$$ = $$5.69 * 10^{-5}$$ Which means it is very least likely to find such a plate randomly. c-The concepts are the same, but the trick here is deciding the entries for the numbers that are divisible by two. The best way to approach these types of problems is by starting the first entry of the number (far right). We know that that only even numbers are divisible by two. So, the possible numbers for the first entry are 0, 2, 4, 6, and 8, which is 5 numbers. The other two digits are the same since the even numbers depend on $$ones$$ only. So the possible outcomes are: $$26*26*26*10*10*5=8788000$$ And the probability will be: $$\frac{8788000}{17576000}=0.5$$ Therefore, it is equally likely to randomly choose a plate with an even or odd number. the d-this problem requires multiple tests till the first success. Hence, the problem follows the geometric distribution. The geometric distribution is fixed: $$P(x)=p(1-p)^{x-1}$$ where x is the number of the successful trial and p is the probability of the successful event. So, $$P(3)=0.5*(1-0.5)^{3-1}=0.0625$$

## Contact tutor

needs and Raad will reply soon.