Tutor profile: Bao P.
Subject: Discrete Math
Show that 17n^3 + 103n is divisible by 6 for ALL integers n.
To show that this problem is divisible by 6 would require a method called Proof By Induction. Essentially, this method is a proof that shows that if any number k that is the same type as n obeys the problem, then any k+1 number, aka the next successive number, should also obey the same rule as k. This is accomplished in 3 steps: 1. Prove that the base case is true. 2. State the hypothesis, with the knowledge that the base case is true. 3. Called the Induction Step; show that any next number n+1 (or k+1) is also true. 1. Base Case: For a number to be divisible by 6, it must be divisible by both 2 and 3 (since 2*3 = 6). For a number to be divisible by 2, the last digit of that number must end with either a 0, 2, 4, 6, or 8. For a number to be divisible by 3, the sum of each individual digit of that number must be either be 0 or be a multiple of 3 (3, 6, 9, 12, 15, ..., etc.). Two base cases will be used: n = 0 and n = 1. For n = 0: 17(0)^3 + 103(0) = 0, which is technically divisible by 3. For n = 1: 17(1)^3 + 103(1) = 120. 120 ends with a 0, so it's divisible by 2. 1 + 2 + 0 = 3, which is a multiple of 3, thus it's divisible by 3. Because 120 is divisible by both 2 and 3, it must be divisible by 6 as a result. 2. Hypothesis: Based on the base case, for any integer k = n, 17*k^3 + 103k must be divisible by 6, so the formula can be written as: 17k^3 + 103k = 6x where x is any integer. 3. Induction Step: For the induction step, we will have to use the same formula in terms of n = k + 1 to show that it will still be divisible by 6. This means that on the right hand side, x will have to be a different variable, so let's use y instead, where y is an integer. Thus, 17*(k + 1)^3 + 103*(k + 1) = 6y Both terms on the left hand side contain (k + 1), so we can factor that out (k + 1) * (17*(k + 1)^2 + 103) = 6y Expanding out the (k + 1)^2 into (k^2 + 2k + 1), (k + 1) * (17*k^2 + 34*k + 17 + 103) = 6y The rest of the steps are simply using algebra to expand and combine like terms (k + 1) * (17*k^2 + 34*k + 120) = 6y 17*k^3 + 34*k^2 + 120*k + 17*k^2 + 34*k + 120 = 6y 17*k^3 + 51*k^2 + 154*k + 120 = 6y From the hypothesis, 17*k^3 = 6x - 103k, so make the necessary substitution and finish the algebra: 6x - 103k + 51*k^2 + 154*k + 120 = 6y 51*k^2 + 51*k + 120 - 6x = 6y 51*k*(k + 1) + 6*(20 - x) = 6y 51*k(k + 1) = 6y - 6*(20 - x), which is our final expression. It may not be obvious that the left hand side is divisible by 6, but the right side should be obvious, since both terms on the right hand side have 6 as a coefficient, implying that the right hand side is divisible by 6. On the left hand side, we know that 51 is divisible by 3, since 5+1 = 6, and 6 is divisible by 3. To show that the left hand side is divisible by 2 as well, let's consider three cases: one where k = 0, one where k is even, and one where k is odd. 1. If k = 0, then 51(0)(0 + 1) = 0, which is divisible by any number. 2. If k is even, then (k + 1) is odd, but even * odd = even number, and all even numbers are divisible by 2. 3. If k is odd, then (k + 1) is even, but odd * even = even number, and all even numbers are divisible by 2. Because both cases 2 and 3 end with an even number, multiplying that by 51, an odd number, would still result in an even number, which is divisible by 2. Because we have shown that all three cases are true, the left hand side of the equation MUST be divisible by 2. In addition, because the left hand side is ALSO divisible by 3, the left hand side must then be divisible by 6, which completes our proof.
You are given a rectangular box with an open top (with the area of the box being 2000 m^2). This box's top and bottom are squares, meaning that the length and width are of equal length. Using this information, there are two parts to this problem: a. Find the maximum dimensions of the box. b. Use part a to find the maximum Volume.
a. Let b represent the base and h represent the height. In a rectangular prism, the Surface Area (SA) of the box has four rectangles (areas together are 4*b*h) and two squares (areas together are 2*b^2). However, since there is an open top, the total SA is SA = 4*b*h + b^2. The volume V is denoted as length * width * height. However, because the length and width are the same, V = b^(2)*h. We now have two equations to use: 1. SA = 4bh + b^2. 2. V = b^(2) * h. However, because we want to eventually find the volume, it would be best to rewrite the V equation in terms of 1 variable. The SA is 2000, so: 2000 = 4*b*h + b^2. In terms of b: h = (2000 - b^2) / 4*b. Now plugging this back into the V equation, V = b^(2)*h = b^(2)((2000 - b^2) / 4*b) = b*((2000 - b^2)/ 4), since there's a b^2 / b. = (2000b - b^3) / 4, distributing the b inside the parentheses. = 500b - (1/4)*b^3. Next, to maximize the Volume of this, we must differentiate V in terms of b and then set dV = 0, which will then leave us with b to solve for. The reason that we set dV = 0 is because the derivative at 0 is where the maximum/minimum occurs in a graph, and this problem asks us to maximize the Volume. dV = 0 = 500 - (3/4)*b^2. From here, simply solve for b, plug it back into the SA equation to find h, where h was found to be (2000 - b^2) / 4*b. However, the detailed work will still be shown below. 500 = (3/4)*b^2 (2000/3) = b^2 b roughly equal to 25.81988897. (NOTE: b = 25.82 m will the used answer, but the entire expression will be plugged in to find h.) h = (2000 - (25.81988897)^2) / 4*(25.81988897) = 12.90994449 or 12.91 m. Thus, the base is around 25.82 m and the height is around 12.91 m. b. Now that we have the maximized dimensions, it only makes sense that the maximized dimensions under the 2000 m^2 box area with an open top constraint will provide the maximum Volume. Once again, the un-rounded answers will be used here. V = b^(2) * h = (25.81988897)^2 * 12.90994449 = 8606.629655 m^3 or 8606.63 m^3. Thus, under these constraints, the box can contain up to roughly 8600 cubic meters of anything.
Subject: C++ Programming
When creating multiple classes with different files associated with each class, how would you make sure that the compiler will not catch any potential "duplicate" errors (i.e., having a base class called Shape and two children classes called Square and Triangle, where all three share a get_area() function)?
Use a header guard on each of the header files associated with each class. The framework looks like the following below on an .h or .hpp file: #ifndef CLASS_X #define CLASS_X //Content of class here #endif. Think of it as a burger. The top bun is the #ifndef and #define lines, the bottom bun is the #endif line, and the patty and other toppings are in the middle.
needs and Bao will reply soon.