### leetcode Question 102: Sqrt(x)

Sqrt(x)

Implement int sqrt(int x).
Compute and return the square root of x.

Analysis:
According to Newton's Method(http://en.wikipedia.org/wiki/Newton's_method), we can use

to get the sqrt(x).

Code:
class Solution {
public:
int sqrt(int x) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if (x==0) {return 0;}
if (x==1) {return 1;}

double x0 = 1;
double x1;
while (true){
x1 = (x0+ x/x0)/2;
if (abs(x1-x0)<1){return x1;}
x0=x1;
}

}
};

Another solution: the binary search approach is a more general way of solving this problem. One thing you need to consider is the length of the input, since taking the mid of a big value and computing its square may overflow the int type.
We can use "long long" , which have a max value 2^63-1.
The max of an int is 2^15-1
The max of a long is 2^31-1

class Solution {
public:
int sqrt(int x) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
long long high = x;
long long low = 0;
if (x<=0) {return 0;}
if (x==1) {return 1;}
while (high-low >1){
long long mid = low + (high-low)/2;
if (mid*mid<=x){low = mid;}
else {high = mid;}
}
return low;
}
};

1. I believe in the interview, they won't expect you to remember Newtown's method. The solution they are expecting is a Binary Search method.

The binary search approach is added to this post.

2. This comment has been removed by the author.

2. Quoting on one line above "The max of an int is 2^15-1", int in most cases is 32 bit, unless for some specific platform.

3. Is there a reason that you use mid = low + (high-low)/2; rather than (high + low)/2; ?

1. Yes, using high+low /2 may cause overflow errors, when high and low both are very big, high+low may exceed and cause the overflow error, while high-low will not.

2. This comment has been removed by the author.

3. Nice solution man. Although I think you need not worry about overflowing: both high and low are within the range [0 INT_MAX], so (high + low) is at most 2*INT_MAX, which can perfectly fit into a 'long long int' integer. So as long as you define high, low and mid as 'long long int', an overflow will never occur.

Or better yet, even if both low and high are defined as 'int', we are still good. Note that it is guaranteed that (int)sqrt(x) < (int)(x/2) for any x >= 6, therefore, for any large enough number, in the first iteration, we have low == 0, so (low + high) is always <= INT_MAX (no overflow). then we always have mid*mid > x, so it is always 'high = mid;' that will be executed in the first iteration, i.e. high <= INT_MAX / 2. From there on, both low and high will be within [0 INT_MAX/2] so (low + high) will never exceed INT_MAX.

Of course 'mid' must be defined as 'long long int' since we need to perform 'mid*mid', which may well exceed INT_MAX. But if we limit the initial value of 'high' to min(std::sqrt(INT_MAX) + 1, x/2), then it is safe to just define 'mid' as 'int'. std::sqrt(INT_MAX) is a constant that can be precomputed so it does not violate the requirement of this problem.

4. should u cast long to int int the end?

5. Decent improvement as (abs(x1-x0)<1) for Newton's Method.


$A \oplus B = A \oplus C$ imply $B = C$?

I don't quite yet understand how $\oplus$ (xor) works yet. I know that fundamentally in terms of truth tables it means only 1 value(p or q) can be true, but not both. But when it comes to solving problems with them or proving equalities I have no idea how to use $\oplus$.

For example: I'm trying to do a problem in which I have to prove or disprove with a counterexample whether or not $A \oplus B = A \oplus C$ implies $B = C$ is true.

I know that the venn diagram of $\oplus$ in this case includes the regions of A and B excluding the areas they overlap. And similarly it includes regions of A and C but not the areas they overlap. It would look something like this:

I feel the statement above would be true just by looking at the venn diagram since the area ABC is included in the $\oplus$, but I'm not sure if that's an adequate enough proof. On the other hand, I could be completely wrong about my reasoning.

Also just for clarity's sake: Would $A\cup B = A \cup C$ and $A \cap B = A \cap C$ be proven in a similar way to show whether or not the conditions imply $B = C$? A counterexample/ proof of this would be appreciated as well.

• For still more fun show that the power set of a set $X$, together with the xor operation, is a group. And, of course, groups have the cancellation law you ask about. – GEdgar Oct 23 '13 at 17:41
• The xor being, in that case, called the symmetric difference. @user101279 : By the way, $\oplus$ is addition modulo $2$. – xavierm02 Oct 23 '13 at 18:04
• Remark also that xor is the addition operation when we regard a Boolean algebra as essentially the same as a Boolean ring. – user43208 Oct 23 '13 at 18:05
• Think of $\oplus$ as $\neq$. – copper.hat Oct 23 '13 at 18:06
• If we omit the question about intersection and union in the last paragraph, this is the same as math.stackexchange.com/questions/294460/… – Martin Sleziak Aug 30 '14 at 15:30

Think of $\oplus$ as $\neq$. That is $A \oplus B$ iff $A \neq B$.

Note that $A \oplus A$ is always false, and $\text{False}\oplus A = A$.

Then $A \oplus (A \oplus B) = (A \oplus A) \oplus B = \text{False} \oplus B = B$.

Similarly, $A \oplus (A \oplus C) = C$, hence $B=C$.

Aside: A 'cute' (as in amusing but not of any practical significance) use of $\oplus$ is to swap the values of two bit variables in a programming language without using an intermediate variable: \begin{eqnarray} x = y \oplus x \\ y = y \oplus x \\ x = y \oplus x \\ \end{eqnarray} Show that the values of $x,y$ are swapped!

Hint: $A\oplus(A\oplus B)=(A\oplus A)\oplus B = B$.

And of course $A\cup B=A\cup C$ does not imply $B=C$ (consider the case $B=A\ne \emptyset = C$). And $A\cap B=A\cap C$ does not imply $B=C$ either (consider the case $A=\emptyset$)

Hint: $\oplus$ is associative with unit $\emptyset$, and $A \oplus A = \emptyset$. Does this give you an idea for canceling?

This can be done using a simple calculation. But I don't know how to interpret your question, so I'll give two answers. :-)

I'm assuming $\;A,B,C\;$ are booleans. I will write $\;\not\equiv\;$ instead of $\;\oplus\;$, and $\;\equiv\;$ instead of $\;=\;$ on booleans.

First, note that $\;\equiv\;$ and $\;\not\equiv\;$ are not only both associative, but they are also mutually associative. Therefore no parentheses are needed in the following calculation.

We can now simplify $\;A \oplus B = A \oplus C\;$ as follows: \begin{align} & A \not\equiv B \equiv A \not\equiv C \\ \equiv & \;\;\;\;\;\text{"rearrange"} \\ & A \not\equiv A \equiv B \not\equiv C \\ \equiv & \;\;\;\;\;\text{"simplify"} \\ & \text{false} \equiv B \not\equiv C \\ \equiv & \;\;\;\;\;\text{"simplify"} \\ & B \equiv C \\ \end{align}

If instead $\;A,B,C\;$ are sets, and your $\;\oplus\;$ is the symmetric difference of two sets (which is normally written as $\;\triangle\;$), then the proof is slightly longer, but with essentially the same structure.

The simplest definition of symmetric difference is $$x \in A \oplus B \equiv x \in A \not\equiv x \in B$$

We can expand the definitions and simplify using logic, as follows: \begin{align} & A \oplus B = A \oplus C \\ \equiv & \;\;\;\;\;\text{"set extensionality; definition of $\;\oplus\;$, twice"} \\ & \langle \forall x :: x \in A \not\equiv x \in B \equiv x \in A \not\equiv x \in C \rangle \\ \equiv & \;\;\;\;\;\text{"logic: rearrange"} \\ & \langle \forall x :: x \in A \not\equiv x \in A \equiv x \in B \not\equiv x \in C \rangle \\ \equiv & \;\;\;\;\;\text{"logic: simplify"} \\ & \langle \forall x :: \text{false} \equiv x \in B \not\equiv x \in C \rangle \\ \equiv & \;\;\;\;\;\text{"logic: simplify"} \\ & \langle \forall x :: x \in B \equiv x \in C \rangle \\ \equiv & \;\;\;\;\;\text{"set extensionality"} \\ & B = C \\ \end{align}

In both cases, we have found a stronger conclusion than was asked: we proved equivalence of the two expressions.

Also just for clarity's sake: Would $A\cup B = A \cup C$ and $A \cap B = A \cap C$ be proven in a similar way to show whether or not the conditions imply $B = C$? A counterexample/ proof of this would be appreciated as well.
$A\cup B=A\cup C$ $\Rightarrow$ $B=C$ is not true in general.
Counterexample: Take any non-empty set $A$ and also take $B=A$ and $C=\emptyset$. Then $A\cup B=A\cup C=A$, but $B\ne C$.
$A\cap B=A\cap C$ $\Rightarrow$ $B=C$ is not true in general.
Take some element $x\notin A$ and put $B=A$, $C=A\cup\{x\}$. Then $A\cap B=A\cap C=A$, but $B\ne C$.


# Biased binary search complexity

We know Binary search on a set of n element array performs O(log(n)).

We have this recursive equation through which the search space is reduced by half in each iteration, after a single comparison.

T(n) = T(n/2) + 1

Either by applying Master's Theorem or analytically we arrive at the complexity of it as log(n)

If I introduce bias, in the search by unequally partitioning the array instead of equal halves, How would the worst case time complexity change?

The unequal partitions are t * n and (1-t) * n where 0<=t<=1

This is a mathematics question as it involves asymptotic analysis and hence I don't wish my question to be downvoted.

• If I understand what you're asking correctly, wouldn't the worst case complexity be $O(n)$ due to it potentially using a partition size of $1$ and $n - 1$, requiring on average $\frac{n}{2}$ checks? Note it should never be worse than $O(n)$ as any type of biased binary search should only ever check each value at the most $1$ time. – John Omielan May 18 at 2:15
• Correct. But I want to come across with an analytical way to calculate the worst case complexity for any particular value of t. In general, it is evident that the worst case complexities are O(n) when t=0 and O(log(n)) when t=1/2. – Argha Chakraborty May 18 at 6:04
• There's nothing special about $t = \frac{1}{2}$. As long as you reduce the problem size by a factor of $t$, for any $0 \leq t < 1$, you will get logarithmic running time. – Joppy May 18 at 7:16
• That is what I want to prove . – Argha Chakraborty May 18 at 7:33

In the worst case scenarios, where $$t = 0$$ or $$t = 1$$, and assuming that at least one value will always be checked, then as I stated in my comment, the average number of checks would be $$\frac{n}{2}$$ and the maximum number would be $$n$$. However, for $$0 \lt t \lt n$$, where $$tn \gg 1$$, then as indicated in the comment by Joppy, the number of steps in the worst case scenario would be logarithmic.

To see this, let

$$u = \max(t, 1-t) \tag{1}\label{eq1}$$

The worst case would be that the value is always in the larger partition after each step, with $$n_i$$ being the size of this partition after $$i$$ steps, and with $$n_0 = n$$. Thus,

$$n_i = un_{i-1} \; \forall \; i \ge 1 \tag{2}\label{eq2}$$

As such, $$n_1 = un$$, $$n_2 = un_1 = u^2 n$$, etc., to get that

$$n_i = u^i n \; \forall \; i \ge 0 \tag{3}\label{eq3}$$

The search will eventually end after $$m$$ steps where

$$u^m n \approx 1 \tag{4}\label{eq4}$$

Note this is similar to the concept of the amount of time for exponential decay to cause a substance to eventually disappear, with the worst case number of unbiased binary searches being about the number of half-life periods. To use a value $$\gt 1$$ for logarithms, let

$$v = \frac{1}{u} \tag{5}\label{eq5}$$

so \eqref{eq4} becomes

$$n \approx v^m \; \implies \; m \approx \log_v(n) = \log_v(e)\ln(n) \tag{6}\label{eq6}$$

For $$t = u = \frac{1}{2}$$, then $$v = 2$$ and \eqref{eq6} gives $$m \approx (1.44269)\ln(n)$$. With a relatively extreme case of $$t = \frac{1}{1001}$$, then $$u = \frac{1000}{1001}$$ and $$v = 1.001$$, so \eqref{eq6} gives $$m \approx (1000.49991)\ln(n)$$, i.e., about $$693.5$$ times as large. Nonetheless, it's still generally considerably faster than just checking each value since, for $$n = 10^{12}$$, \eqref{eq6} gives $$m \approx (1000.49991)(27.63102) \approx 27644.8$$, so it's about $$\frac{10^{12}}{27644.8} \approx 3.61731 \times 10^7$$ times faster.

The cases $$t=0$$ and $$t=1$$ do not correspond to a terminating algorithm. Otherwise, the behavior remains logarithmic.

In the worst case, the array is every time reduced according to the smaller of $$t$$ and $$1-t$$; WLOG, let $$t$$.

After $$k$$ steps, we approximately reduce from $$n$$ to $$nt^k\sim 1$$, so that $$k\sim-\log_tn$$.


# How to put a matrix in Jordan canonical form, when it has a multiple eigenvalue?

Put the matrix $$\begin{bmatrix} 3 & -4\\ 1 & -1\end{bmatrix}$$ in Jordan Canonical Form. Moreover, find the appropriate transition matrix to the basis in which the original matrix assumes its Jordan form.

I'm having a lot of trouble with this. I know that the eigenvalue has multiplicity two and is $\lambda = 1$. I can find the first eigenvector, which is:

\begin{bmatrix} 2 \\ 1 \\ \end{bmatrix} I'm having trouble finding the second since both eigenvalues tell us the same thing. But I'm not nearly as concerned about the eigenvectors as I am about what to do after.

If anyone could explain thoroughly the next steps involved (not necessarily the answer but how to obtain it), I would be forever grateful. This homework is in 2 days and it may determine my grade letter.

• Yes, I know the only eigenvalues are one. The problem is finding the eigenvectors corresponding to 1 and more importantly how to proceed. – Arbitrationer Nov 23 '14 at 5:43
• You don't seem to understand that when vadim wrote, "the eigenspace corresponding to $\lambda=1$ is one-dimensional", he was telling you there is only the one eigenvector that you have found (and scalar multiples of that eigenvector, but they don't help). What you need is a generalized eigenvector; a vector $w$ such that $(A-\lambda I)w=v$, where $v$ is the eigenvector you have found. Do you not have a text, or some notes to follow? Anyway, "generalized eigenvector" is the keyphrase: go look it up, and then post an answer when you have worked out how to solve the problem. – Gerry Myerson Nov 23 '14 at 6:16

To put a matrix in Jordan normal form requires to know three matrices such that $A=PJP^{-1}$ i.e: a matrix $P^{-1}$ that transform to the canonical basis $(\mathbf{i},\mathbf{j},\mathbf{k})$ to a new basis in which the matrix $J$ represents the transformation of a vector $\mathbf{v}$ such that the transformed vector $\mathbf{v'}$ is the same as we find when we transform $\mathbf{v}$ with $A$ in the canonical basis. Last the matrix $P$ returns this result to the canonical basis.

As noted in OP the matrix $A$ has eigenvalues $\lambda_1=\lambda_2=1$ and a single eigenvector $$\mathbf{u_1}=\left[ \begin{array}{cccc} 2\\ 1 \end {array} \right]$$

So the main problem is to find another vector that completes the new basis.

To find such a vector notes that all vectors $\mathbf{x}$ such that $(A-\lambda I)\mathbf{x}=0$ are transformed in the eigenspace generated by the eigenvector $\mathbf{u_1}$, so we want a vector $\mathbf{u_2}$ such that $(A-\lambda I)\mathbf{u_2} \ne 0$, and the way to do this is to find a vector such that : $(A-\lambda I)\mathbf{u_2} = \mathbf{u_1}$. (Note that this equation is the same as $(A-\lambda I)^2\mathbf{u_2}= 0$).

Solving in our case we find: $$\left[ \begin{array}{cccc} 2&-4\\ 1&-2 \end {array} \right] \left[ \begin{array}{cccc} x\\ y \end {array} \right]= \left[ \begin{array}{cccc} 2\\ 1 \end {array} \right]$$

so that the components $x$ and $y$ of the searched vector must satisfies $x-2y=1$, and we can find the vector $$\mathbf{u_2}= \left[ \begin{array}{cccc} 1\\ 0 \end {array} \right]$$ So the matrix $P$ we are searching is $$P=[\mathbf{u_1},\mathbf{u_2}]= \left[ \begin{array}{cccc} 2&1\\ 1&0 \end {array} \right]$$ And the inverse is: $$P^{-1}= \left[ \begin{array}{cccc} 0&1\\ 1&-2 \end {array} \right]$$ The matrix $J$ is a typical Jordan block, with the eigenvalues as diagonal elements and an entry $1$ up-right them: $$J= \left[ \begin{array}{cccc} 1&1\\ 0&1 \end {array} \right]$$ and we can easily verify that $A=PJP^{-1}$.

The characteristic polynomial $\det (A - \lambda I) = (\lambda -1)^2.$ when the dimension of the null space(1) of an eigenvalue($\lambda = 1$) is less than the algebraic multiplicity(2), you need to find generalized eigenvectors. in this instance, you need to solve $(A - I_2) \left( \begin{array}{l} x \cr y\end{array} \right) = \left( \begin{array}{l} 2 \cr 1 \end{array} \right).$ this gives you $x = 1, y = 0$

with respect to the basis $\{ \left( \begin{array}{l} 2 \cr 1 \end{array} \right), \left( \begin{array}{l} 1 \cr 0 \end{array} \right) \}$ you transformation is represented by the Jordan canonical form $\left( \begin{array}{ll} 1 & 1 \cr 0 & 1 \end{array} \right).$

• Might have been better to let OP do some of the work. – Gerry Myerson Nov 23 '14 at 23:27
• @myerson, perhaps i should have not done all the work. – abel Nov 23 '14 at 23:57


# Can a gradient vector field with no equilibria point in every direction?

Suppose that $V:\mathbb{R}^n \to \mathbb{R}$ is a smooth function such that $\nabla V : \mathbb{R}^n \to \mathbb{R}^n$ has no equilibria (i.e. $\forall x \in \mathbb{R}^n : \nabla V (x) \not = 0$). Under these hypotheses, is it possible that $\nabla V (x)$ can point in every direction?

To be more precise, under the above hypotheses the map $$\mathbb{R}^n \to \mathbb{S}^{n-1}$$ $$x \mapsto \frac{\nabla V(x)}{\|\nabla V (x)\|}$$ is well-defined. Is it impossible for such a map to be surjective? If not, what is a counterexample?

• I believe this is possible from $R^2$ onwards. Can you write down a function for which one gradient flow line makes an $S$ shape? Can you make sure that at some distance from this $S$ the flowlines it straighten to vertical straight lines? If you can do that you can mirror this construction and obtain the right function. – Thomas Rot Mar 15 '16 at 14:18
• That's an interesting idea. It seems plausible, but I'm having some trouble actually writing down such a function. – Matthew Kvalheim Mar 15 '16 at 16:55
• The more I think about it, I'm not sure a function satisfying the requirements @ThomasRot suggested exists. – Matthew Kvalheim Mar 15 '16 at 23:57
• A cool question! Also, it might be received well in MathOverflow, but given that you started a bounty I would think it better to let the bounty period expire before we consider migration. If you are in a hurry, respond to this and/or flag again. – Jyrki Lahtonen Mar 19 '16 at 6:53

A quick solution for $n=2$, and an explanation of where it came from: $$\nabla (e^x \sin y) = (e^x \sin y, e^x \cos y).$$ The right hand side is never zero, but does assume every nonzero value in $\mathbb{R}^2$.

Motivation: If $f: \mathbb{C} \to \mathbb{C}$ is holomorphic, then $\nabla(\mathrm{Re}(f)) = (\mathrm{Re}(f'), -\mathrm{Im}(f'))$. I looked for an $f'$ (namely $e^z$) which takes $\mathbb{C}$ onto $\mathbb{C}_{\neq 0}$, and then integrated it to find $f$.

Inspired by this, let's try $$\nabla(e^{x_0} \cos(x_1^2+x_2^2+\cdots + x_n^2)) =$$ $$e^{x_0} (\cos(x_1^2+\cdots + x_n^2), - x_1 \sin(x_1^2+\cdots + x_n^2), \cdots, -x_n \sin(x_1^2+\cdots + x_n^2)).$$

First, we note that the gradient is not zero. The first coordinate only vanishes if $x_1^2+ \cdots + x_n^2$ is of the form $(2k+1) \pi$. But, in this case, at least one of $x_1$, $x_2$, ..., $x_n$ are nonzero; say $x_j$. Then $- x_j \sin(x_1^2+\cdots + x_n^2) = \pm x_j \neq 0$.

Now, let's take a nonzero vector $(v_0, \ldots, v_n)$. We need to go through cases.

If $v_0 = 0$, choose $(x_1, \ldots, x_n)$ proportional to $(v_1, \ldots, v_n)$ and such that $\sin(x_1^2+\cdots+x_n^2)$ has the right sign.

If $v_1 = \cdots = v_n = 0$ and $(-1)^k v_0>0$, take $x_1^2+\cdots+x_n^2 = k \pi$.

If neither of those cases holds, we'll take $(x_1, \ldots, x_n)$ of the form $(t v_1, \ldots, t v_n)$ for some $t$ to be determined soon. Set $s = x_1^2+ \cdots + x_n^2$. Then our vector points in direction $\pm (- \cot(t^2 s), v_1, v_2, \ldots, v_n)$. Since cotangent is surjective, we can choose $t$ such that $\cot (t^2 s) = v_0$, and we can get the sign right.

• Thank you for the insightful answer. Your counterexample for $\mathbb{R}^2$ and the motivation you gave are quite helpful. – Matthew Kvalheim Mar 24 '16 at 22:31

It is possible to have a vector field without equilibrium point and takes every possible directions in $\mathbb{R^n}$ for any $n \ge 2$.

The proof for the 2-dimension case is given below. From that, vector fields for higher dimension cases can be constructed.

Let $\rho : (-\epsilon,\infty) \to \mathbb{R}$ be any $C^\infty$ function such that

1. $\rho(t)$ is even over $(-\epsilon,\epsilon)$ and $\rho(0) = \rho'(0) = 0$.
2. $|r\rho'(r)| < 1$ for all $r \ge 0$.
3. for some $r_c > 0$, $\rho(r_c) = 2\pi$.
4. for some $r_m > 0$, $N \in \mathbb{Z}$, $\rho(r) = 2\pi N$ for all $r \ge r_m$.

For any point $(x,y) \in \mathbb{R}^2$, let $(r,\theta)$ be the corresponding polar coordinates.
Let $\hat{e}_x, \hat{e}_y, \hat{e}_r, \hat{e}_\theta$ be unit vectors along the $x$, $y$, $r$ and $\theta$ directions respectively.

Consider following function $$U(x,y) = r\cos(\theta - \rho(r)) = x\cos\rho(r) + y\sin\rho(r)$$ Its gradient is given by:

\begin{align} \vec{\nabla} U &= \hat{e}_x \left( \cos\rho + \frac{x\rho'}{r}( -x \sin\rho + y\cos\rho )\right) + \hat{e}_y \left( \sin\rho + \frac{y\rho'}{r}( -x \sin\rho + y\cos\rho )\right)\\ &= \hat{e}_r\left(\cos(\theta - \rho) + r\rho'\sin(\theta-\rho)\right) -\hat{e}_\theta\left(\sin(\theta-\rho)\right) \end{align} From these two expressions, it is easy to deduce

• $\vec{\nabla} U$ is well defined at $(0,0)$ because $\rho'(0) = 0$.
• $\vec{\nabla} U(0,0) = \hat{e}_x$ because $\rho(0) = \rho'(0) = 0$.
• $\vec{\nabla} U \ne 0$ for $r > 0$ because \begin{align} |\vec{\nabla} U| &= |\hat{e}_r\left(\cos(\theta - \rho) + r\rho'\sin(\theta-\rho)\right) -\hat{e}_\theta\left(\sin(\theta-\rho)\right)|\\ &\ge |\hat{e}_r\left(\cos(\theta - \rho)\right) -\hat{e}_\theta\left(\sin(\theta-\rho)\right)| - |\hat{e}_e \left(r\rho'\sin(\theta-\rho)\right)|\\ &\ge 1 - |r\rho'| > 0 \end{align}

Combine these, we find $\nabla U \ne 0$ over $\mathbb{R}^2$. This allow us to define following unit vector field globally on $\mathbb{R}^2$.

$$\hat{u}(x,y) = \frac{\vec{\nabla}U(x,y)}{\left|\vec{\nabla}U(x,y)\right|}$$

Over the curve $\displaystyle\;\gamma : [0,r_c] \ni t \quad\mapsto\quad (t\cos\rho(t),t\sin\rho(t)) \in \mathbb{R}^2\;$, we have $$\hat{u}(t) = \hat{e}_r = \hat{e}_x \cos\rho(t) + \hat{e}_y\sin\rho(t)$$ As we move from $\gamma(0)$ to $\gamma(r_c)$ along $\gamma$, $\hat{u}(\gamma(t))$ will cover the whole $S^1$ at least once. The map $\hat{u}$ is surjective on $\gamma$ and hence on $B(0,r_c)$ and $\mathbb{R}^2$. This means $U$ is a counter-example of $V$ for the 2-dimenisonal case.

As an illustration, following is a picture of what $U(x,y)$ will typically look like under this construction.

$\hspace0.75in$

This particular $U(x,y)$ is computed using

\rho(t) = 2\pi + (f(t)-2\pi)g(t) \quad\text{ where }\quad \begin{align} f(t) &= \log\sqrt{(e^{4\pi}-1)t^2 + 1}\\ g(t) &= \begin{cases} 1, & t \le 1\\ 1 - e^{-1/(e^{t-1} -1)}, & t > 1\end{cases} \end{align} and plotted over the region $|x|,|y| \le 2$. This $\rho(t)$ satisfies the first three requirement in the beginning of this answer with $r_c = 1$. For $r \gg r_c$, $\rho(t)$ tends to $2\pi$ exponentially as $t \to \infty$.

Back to the case of higher dimensions. Let's say we do have a $\rho$ that satisfies all four conditions. Consider following function:

$$V(x_1,x_2,\ldots,x_n) \stackrel{def}{=} U\left( x_1, \sqrt{x_2^2 + x_3^2 + \cdots + x_n^2} - (r_m+1)\right)$$

Since $B(0,r_m) \supset B(0,r_c)$, the map $\frac{\vec{\nabla}V}{|\vec{\nabla}V|}$ will be surjective over the hyper-torus $$\bigg\{ (x_1,\ldots,x_n) : x_1^2 + \left(\sqrt{x_2^2 + x_3^2 + \cdots + x_n^2} - (r_m+1)\right)^2 \le r_m^2 \bigg\}$$ Since $U(x,y) = x$ whenever $x^2 + y^2 \ge r_m^2$, $V(x_1,\ldots,x_n)$ equals to $x_1$ over the complement of the hyper-torus. As that contains the $x_1$-axis, the square root in the definition of $V$ won't cause any problem. This makes $V$ smooth everywhere. Finally, it is easy to check $\nabla V$ never vanishes.

Update

About the question how this particular form of $\rho(t)$ is chosen.

First, $\rho(r)$ cannot change too rapidly or $\nabla U$ may become zero somewhere.
Second, we need $\rho(r)$ span across around a large enough interval to make $\hat{u}(r)$ surjective.
This suggest us to choose a $\rho(r)$ with $\rho'(r)$ as close to $\frac{1}{r}$ as possible. This means $$\rho(r) \sim \log r + constant.$$ In order for $U(x,y)$ to be smooth at the origin, I replace $\log r$ by $\log\sqrt{(e^{4\pi}-1)r^2 + 1}$. The constants are chosen so that when $r$ changes from $0$ to $1$, $\rho(r)$ pick up a change of $2\pi$ which we need.

Finally, we want $\rho(r)$ decay back to a constant multiple of $2\pi$ for large $r$ while keeping smooth all the way. We need this in order to extend the result to higher dimensions. This can be done using a smooth Partition of unity. The function $g(r)$ in the formula doesn't really have any specific meaning. It is simply something from trial and error which works.

• May I ask how you came up with the particular example of $\rho$ you gave? I'd like to understand the intuition behind your thought process. – Matthew Kvalheim Mar 21 '16 at 21:43
• @MatthewKvalheim answer updated, see rationale of chosing such a $\rho$. – achille hui Mar 21 '16 at 22:25
• You wrote an expression for $\nabla U$ that involves division by $r$. Am I correct in the interpretation that you actually mean that $\nabla U$ is defined by the expression you wrote on $\mathbb{R}^2\setminus \{0\}$, and $\hat{e}_x$ at the origin? – Matthew Kvalheim Mar 22 '16 at 3:49
• Thank you very much for your help. – Matthew Kvalheim Mar 22 '16 at 3:58
• @MatthewKvalheim $\nabla U$ is defined as the gradient of $U$. What I mean is it "equals to" the expression involves division by $r$ for $r \ne 0$ and $\hat{e}_x$. – achille hui Mar 22 '16 at 9:15


# Rationalizing denominator of $\frac{18}{\sqrt{162}}$. Cannot match textbook solution

I am given this expression and asked to simplify by rationalizing the denominator:

$$\frac{18}{\sqrt{162}}$$

The solution is provided:

$$\sqrt{2}$$

I arrived at:

$$\frac{\sqrt{162}}{9}$$

Here is my thought process to arrive at this incorrect answer:

$$\frac{18}{\sqrt{162}}$$

= $$\frac{18}{\sqrt{162}}$$ * $$\frac{\sqrt{162}}{\sqrt{162}}$$

= $$\frac{18\sqrt{162}}{162}$$

= $$\frac{\sqrt{162}}{9}$$

How can I arrive at $$\sqrt{2}$$ ?

• Hint: $162=2\cdot 81$. Jan 3 '19 at 4:52
• $162=2*81=2*9^2$ so $\sqrt {162}=\sqrt {2*9^2}=9\sqrt 2$. If your hadn't "deradicalized" the denominator you would have ended up with $\frac 2 {\sqrt 2}$ which is also deradicalized as $\sqrt 2$. Jan 3 '19 at 5:49

$$\frac{\sqrt{162}}{9} = \frac{\sqrt{2 \cdot 9^2}}{9} = \frac{9\sqrt{2}}{9} = \sqrt{2}$$.

$$\require{cancel}\frac{18}{\sqrt{162}}=\frac{2\cdot3^2}{\sqrt{2\cdot3^4}}=\frac{2\cdot\cancel{3^2}}{\sqrt{2}\cdot\cancel{3^2}}=\frac{2}{\sqrt{2}}\cdot\frac{\sqrt{2}}{\sqrt{2}}=\frac{\cancel2\sqrt{2}}{\cancel{2}}=\sqrt{2}$$

Your thought process is good. But just continue with factorizing $$162=2*81=2*3^4$$.

So $$\sqrt {162}=\sqrt {2*3^4}=\sqrt {2}\sqrt {3^4}=\sqrt 2*3^2=9\sqrt 2$$ and from there.... it's just mechanics.

$$\sqrt{162}$$ needs to be simplified further, as $$162$$ is the product containing a perfect square (i.e. $$81$$). Thus $$\sqrt{162} = \sqrt{2 \cdot 81} = \sqrt{2}\sqrt{81} = 9\sqrt{2}$$

and hence $$\frac{\sqrt{162}}{9} = \frac{9\sqrt{2}}{9} = \sqrt{2}$$

Alternatively if $$a = \frac{18}{\sqrt{162}}$$, $$a^2 = \frac{18^2}{\sqrt{162}^2} = \frac{324}{162} = 2$$. Since $$a$$ is a positive number, $$a = \sqrt{2}$$.


# How do you solve an equation like this?

We have an equation:

$\dfrac{p-1}{q} = \dfrac{q-1}{2p+1} = \dfrac {3}{5}$

How do you solve these types of equations? For example, if we have:

$\dfrac{1}{x} = \dfrac{3}{2}$, we use:

$1\times 2 = 3\times x$

$x = 1.5$

What is a similair approach to my equation?

-
Yes, exactly. First forget about the middle term. Next, forget about the $\frac35$. And then you're done. –  Berci Nov 1 '12 at 19:29

Essentially, you can solve this using the process you describe, but twice, to generate two equations in two variables, and then solving for each variable as a "system of equations".

We have:

$$\dfrac{p-1}{q} = \dfrac{q-1}{2p+1} = \dfrac {3}{5}$$

Equation 1: $\quad 5(p-1) = 3q \iff 5p - 3q = 5$

Equation 2: $\quad 5(q-1) = 3(2p +1) \iff -6p +5q=8$

So your system of two equations in two unknowns becomes:

$$5p - 3q = 5\tag{1}$$ $$-6p +5q=8\tag{2}$$

Can you take it from there?

You can express (1) as a function of p (isolate p), and then substitute the expression obtained for p, into p in (2), and then solve for q, then p,

or

You can use "row operations": multiply (1) by 5 (both sides), and (2) by 3 (both sides):

$$25p-15q=25\tag{1}$$ $$-18p+15q = 24\tag{2}$$

Now add the equations (q disappears), solve for p, then "plug" p into one of the original equations and solve for q:

$$7p = 49n\implies p = 7$$

Now...From (1), originally, above

$$5p-3q=5 \implies 5(7) - 3q = 5\implies 35 - 3q = 5$$ $$\implies -3q=-30 \implies q = 10$$

-
Thank you sir, I am familair with row operations so I won't have trouble with these types of equations again. –  JohnPhteven Nov 1 '12 at 19:49
(+1) Step by step getting the answer. –  Babak S. Aug 6 '13 at 10:15

You have two equation with two variables: $$1) \quad \frac{p-1}{q} = \frac{3}{5}$$ and $$2) \frac{q-1}{2p+1}=\frac{3}{5}$$

$1)$ Implies that $5(p-1)= 3q$, which gives $q= \frac{5(p-1)}{3}$. Then you can insert $q= \frac{5(p-1)}{3}$ in $(2)$. Then find what is $p$, and then you can find what $q$ is.

-

$$\frac{p-1}{q} = \frac{q-1}{2p+1} = \frac {3}{5}$$ so $$\frac{p-1}{q}=\frac {3}{5}$$ and $$\frac {3}{5}=\frac{q-1}{2p+1}.$$ \begin{eqnarray} 5p-5&=3q&\\ 6p+3&=&5q-5 \end{eqnarray} $$5p-3q=5$$ $$6p-5q=-8$$ $$30p-18q=30$$ $$30p-25q=-40$$ $$-7q=-70$$ $$q=10$$ $$p=7.$$

-
$p = 7$? :) ${}{}$ –  Alex Nov 1 '12 at 19:37
is there a problem ? –  Iuli Nov 1 '12 at 19:47

From $$\dfrac{p-1}{q} = \dfrac{q-1}{2p+1} = \dfrac {3}{5}$$ follow the system of linear equations with two unknowns

$$5(p-1)=3q$$ $$5(q-1)=3(2p+1)$$ or $$5p-3q=5$$ $$6p-5q=-8$$

wich can be solved using for example Cramer rule

$\Delta=-25+18=-7$

$\Delta_p=-25-24=-49$

$\Delta_q=-40-30=-70$

$$p=\frac{\Delta_p}{\Delta}=\frac{-49}{-7}=7$$,$$q=\frac{\Delta_q}{\Delta}=\frac{-70}{-7}=10$$

-


# Getting an X for Chinese Remainder Theorem (CRT)

how do I get modulo equations to satisfy a given X in CRT.

For example say I have X = 1234. I choose mi as 5, 7, 11, 13. This satisfies the simple requirements of Mignotte's threshold secret sharing scheme. More precisely given in my example k = n = 4, and the product of any k - 1 is smaller then X how come simply computing the remainder of each won't give equations that solve to X = 1234.

In the case of the example,

x = 4 mod 5
x = 2 mod 7
x = 2 mod 11
x = 12 mod 13

Which resolves to 31264 (won't CRT produce the smallest?)

Any hints?

The final result of the CRT calculation must be reduced modulo 5 x 7 x 11 x 13 = 5005. This gives the correct answer.

Here is a much simpler way to immediately obtain the sought answer. Contrast the solution below to the much longer solution in your link, which involves calculations with much larger numbers and performs $4$ inversions vs. the single simple inversion below. Always search for hidden innate structure in a problem before diving head-first into brute-force mechanical calculations!

The key insight is: the congruences split into pairs with obvious constant solutions by CCRT, viz.

\begin{align}\rm\quad\quad\quad\quad\quad x\equiv \ \ \ 2\ \ \:(mod\ 7),\ \ x\equiv \ \ \ 2\ \ \:(mod\ 11)\ \iff\ x\equiv \ \ \ \color{#0a0}2\ \ (mod\ \color{#0a0}{77})\\[0.3em] \rm\quad\quad\quad\quad\quad x\equiv -1\ \ (mod\ 5),\,\ \ x\equiv\ {-}1\ \ (mod\ 13)\ \iff\ x\equiv \color{#c00}{-1}\ \ (mod\ \color{#c00}{65})\end{align}

So we reduced the above four original LHS equations to the above two RHS equations, which are easy to solve by CRT = Chinese Remainder Theorem.  Indeed, applying Easy CRT below

$\rm\quad\quad\quad\quad\quad x\equiv\ \color{#0a0}{2 + 77}\ \bigg[\displaystyle\frac{\color{#c00}{-1}-\color{#0a0}2}{\color{#0a0}{77}}\ mod\,\, \color{#c00}{65}\bigg]\,\ \ (mod\ 77\cdot65)$

In the brackets $\,\rm\displaystyle\left[\, mod\ \ 65\!:\ \ \frac{-3}{77} \equiv \frac{-3}{12} \equiv \frac{-1}4 \equiv \frac{64}4 \equiv \color{#d0f}{16}\,\right]\quad$ (see Beware below)

This yields $\rm\ \ x\ \equiv\ \color{#0a0}{2 + 77}\,[\,\color{#d0f}{16}\,] \equiv 1234\,\ \ (mod\ 77\cdot 65)\quad$ QED

Theorem $\:$ (Easy CRT) $\rm\ \$ If $\rm\ m,\:n\:$ are coprime integers then $\rm\ m^{-1}\$ exists $\rm\ (mod\ n)\ \$ and

$\rm\displaystyle\qquad\quad\quad\quad \begin{eqnarray}\rm x&\equiv&\!\rm\ a\ \ (mod\ m) \\ \rm x&\equiv&\!\rm\ b\ \ (mod\ n)\end{eqnarray} \ \iff\ \ x \equiv\, a + m\ \bigg[\frac{b-a}{m}\ mod\ n\,\bigg]\,\ \ (mod\ m\:n)$

Proof $\rm\ (\Leftarrow)\ \ \ mod\ m:\,\ x \equiv a + m\ [\,\cdots\,] \equiv a,\$ and $\rm\ mod\ n\!\!:\,\ x \equiv a + (b\!-\!a)\ m/m \equiv b$

$\rm (\Rightarrow)\ \$ The solution is unique $\rm\ (mod\,\ mn)\$ since if $\rm\ x',\:x\$ are solutions then $\rm\ x'\equiv x\$ mod $\rm\:m,n\:$ therefore $\rm\ m,n\ |\ x'-x\ \Rightarrow\ mn\ |\ x'-x\ \$ since $\rm\ \:m,n\:$ coprime $\rm\:\Rightarrow\ lcm(m,n) = mn\ \ \$ QED

Note $\$ Easy CRT is not only easy to apply, but also very easy to remember. Namely note $\rm\ x\equiv a\pmod{\! m}\iff x = a + m\,k,\:$ for some integer $\rm\:k,\,$ This further satisfies the second congruence iff $\rm\ mod\ n\!:\ x = a + m\,k\equiv b$ $\iff$ $\rm k\:\equiv (b-a)/m,\$ hence the Easy CRT formula. This explains the $(\Leftarrow)$ proof:  fill in the dots in $\rm\:x\equiv a + m\ [\,\cdots\,]\:$ to make $\rm\,x\equiv b\pmod{\! n}$

Beware $\$ Modular fraction arithmetic is well-defined only for fractions with denominator coprime to the modulus. See here for further discussion.

Below is the solution you linked to on "Math Celebrity" (cached to avoid link rot).

• @Bill Dubuque: But the OP was just giving an example! Your solution is completely useless for any other, similar problem. Unless you can automate it, of course :-) – TonyK Feb 3 '11 at 17:27
• @TonyK: Most certainly not true. Most math problems do have interesting structure, esp. problems that are designed for tests, competitions etc. In fact this is frequently true even in research problems. Indeed, speaking as a number theorist, I can tell you that methods like the above are very useful in practice. In mathematics, intuition always trumps brute force. – Bill Dubuque Feb 3 '11 at 17:34
• @Bill Dubuque: Well, your methods might be much, much simpler for you. But if they require years of practice, they're not so useful for people like me (or, presumably, the OP). – TonyK Feb 3 '11 at 18:05
• @Tonyk: The above solution can be understood by a bright high-school student. Simple optimizations like the above arise frequently in elementary number theoretical problems, so it is well-worth knowing them. – Bill Dubuque Feb 3 '11 at 18:54
• @TonyK: The optimization I employed above is algorithmic and is frequently applicable in practice. But that was not my point in presenting the above. Rather, it was to emphasize conceptual vs. algorithmic thought - intuition vs. brute force. Mathematical problems are far from random. Typically they involve much structure and their solution requires insightful exploitation of such innate structure - something that cannot be algorithmic (indeed many math problems are algorithmically unsolvable - that's what makes them interesting). – Bill Dubuque Feb 4 '11 at 0:37


# Weighted Mean

Variance is also based on the mean of your data. 0 (2016-2017), but may apply to other versions as well. This is a correct assumption if the same technique is used to measure the same parameter repeatedly. , Features, Capabilities, and Epics) to produce maximum economic benefit. Here is the mean of 1, 2, 3 and 4: Add up the numbers, divide by how many numbers: Mean = 1 + 2 + 3 + 44 = 104 = 2. weighted mean shift free download. Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Abstract It is well known that the out-of-sample performance of Markowitz’s mean-variance portfolio criterion can be negatively aﬀected by estima- tion errors in the mean and covariance. using excel to calculate the weighted standard deviation Does anyone know the formula for computing the weighted standard deviation? I was able to calculate the weighted average (16. You simply add up all the item values and divide by the total. This calculator will calculate the weighted average APR for all of your credit cards that have a current balance. Basically I calculate the most recent RSI value and it's exponentially weighted mean based on the window length selected. Water-Quality Characteristics. I am trying to calculate the mean profit percentage, but a free item is given when a certain amount of goods are bought. geometric mean concentration at which shellfish beds or swimming beaches must be closed. Weighted means are often used for frequency data. Weighted blankets, sometimes referred to as gravity blankets, were once a tool of therapists and psychiatry clinics. Purpose: To report design of a simplified external transmit-receive coil array for 7 Tesla (T) prostate MRI, including demonstration of the array for tumor localization using T2-weighted imaging (T2WI) at 7T before prostatectomy. Adding all of these totals up yields a weighted average of 5. Ranking, Matrix/Rating Scale, Multiple Choice, Multiple Textboxes, and Slider questions calculate an average or weighted average. How to calculate weighted mean in IBM SPSS? Using the results of the survey I need to create the rating of governmental organizations. A method of computing a kind of arithmetic mean of a set of numbers in which some elements of the set carry more importance (weight) than others. org Dictionary. Acronym/Abbreviation meaning of CAC The acronym CAC() means : Capital Access Corporation. test – here they are (the weighted variance is from Gavin Simpson, found on the R malining list): View Code RSPLUS. Compute the weighted mean of a variable. Suppose your teacher says, "The test counts twice as much as the quiz and the final exam counts three times as much as the quiz". Dec 10, 2010 · The IRR, also commonly referred to as the dollar weighted return, is the measurement of a portfolio’s actual performance between two dates, including the effects from all cash inflows and outflows. Recommended Articles. … If all the weights are equal, then the weighted mean is the same as the arithmetic mean. Finally, the query uses a GROUP BY clause to combine the data so that the calculation is performed for each gender. WMC is sampling-, scale-, and contrast-invariant, and is sparse on natural images. A weighted average, for example, takes into account the proportional. The AVERAGE function below calculates the normal average of three scores. Weighted Vest FAQs Weighted vests are often recommended for children with autism. 04 (df = 3, p <. It is based on kernel weighted sample statistics such as the mean (Nadaraya-Watson estimator) but also standard deviation, skewness, kurtosis, deciles, etc. Follow the example below to calculate the weighted average interest rate for a federal loan consolidation. Find the weighted average of class grades (with equal weight) 70,70,80,80,80,90: Since the weight of all grades are equal, we can calculate these grades with simple average or we can cound how many times each grade apear and use weighted average. mean, or in other words searching the explicit expression of the weighted mean standard deviation distribution, under the safely motivated restriction of independent measures obeying Gaussian distributions. also i thought weighted mean measures the tendency of respondents answers to various questions. It is an average in which each quantity to be averaged is assigned a. Under Medicare Advantage, the federal government still foots the. weighted dataset, others simply recommend replacing the weighted base sizes with the unweighted base sizes in the test statistic formula, while still using the weighted summary statistics such as mean and standard deviation. Most companies weight the revenue based on the opportunity success %. The choice of Galloway et al. This is because the basic average of a group of numbers is the same calculation as a weighted average except that the weights of all the numbers are calculated as being the same. In calculating a weighted average, each number in the data set is. Weighted Mean (ratio statistics algorithms) A / S = n Σ i = 1 f i A i n Σ i = 1 f i S i = n Σ i = 1 f i S i R i n Σ i = 1 f i S i This is the weighted mean of the ratios weighted by the sales prices in addition to the usual case weights. Free Arithmetic Mean (Average) Calculator - find the average of a data set step-by-step. Another Tip: If number of boys and girls is same, i. The first or shorter echo (TE < 30msec) is proton density (PD) weighted or a mixture of T1 and T2. then the variance of the mean could be estimated with. The idea of weighted mean plays a role in descriptive statistics and also occurs in a more general form in several other areas of mathematics. Given N jobs where every job is represented by following three elements of it. weighted-mean definition: Noun (plural weighted means) 1. Define weighted. … So let's set up the ability to do a weighted mean … versus a mean. To calculate a weighted average in Excel, simply use the SUMPRODUCT and the SUM function. In this article, I'll go through a basic description of what a weighted GPA is, why it matters for you, and how you can calculate your own weighted GPA if your school uses this type of scale. a point lying far from the rest). The weighted arithmetic mean (or weighted average) is used if one wants to combine average values from samples of the same population with different sample sizes: ¯ = ∑ = ∑ =. The WAM can be used to gain an average of an applicant results using their grades and unit credit value. Get Your Weighted And Unweighted GPA In Just A Few Minutes! This quick and easy online GPA calculator computes both weighted and unweighted high school grade point averages (GPA). However, Property Use Details can change over the course of the 12 months, so we time-weight them so they are appropriately attributed. It is challenging to achieve high weighted efﬁciency with low-power microinverters, typically because these devices are required to be low cost. Variance[wd] / n where n is sample size. Weighted arithmetic mean is used when the values are of different importance - weight p to be assigned to each value. More periods with zero is less scale sensitive than the MAPE and the MAD. Specify the plan goal weights for each of the three goal levels (the total must be 100 percent). POSIXct, colMeans for row and column means. Definition of weighted mean in the Definitions. The tutorial is mainly based on the weighted. Get Your Weighted And Unweighted GPA In Just A Few Minutes! This quick and easy online GPA calculator computes both weighted and unweighted high school grade point averages (GPA). It often occurs, however, that one must combine two or more measurements of the same quantity with differing errors. Title: Variance of a Weighted Mean Created Date: 20160808202903Z. Use 'weighted average' in a Sentence. A combination of medication, lifestyle changes and other treatments can help limit the impact of anxiety and its symptoms. µ = P n Pi=1 w ix i n i=1 w i (45) It is equivalent to the simple mean when all the weights are equal, since µ = P n P i=1 wx i n i=1 w = w P n x i nw = 1 n X i=1 x i (46) If the samples are all diﬀerent, then weights can be thought of as sample frequencies, or they can be used to calculate probabilities where p i = w i/ P w i. mean() while aggregating a data frame. …Let's consider an academic course as our example. Dec 30, 2016 · Weighted Average is a free application for students. 04 (df = 3, p <. As a result, practitioners usually rely on vendor specified parameters, such as mean-time-to-failure (MTTF), to model failure processes, although many are skeptical of the accuracy of those models [4,5,33]. 5 for Stock C, or 3. The first section which takes up columns A, B, and C is the weighted averages. Select a stem that prompts several possible responses, with one that is the most accurate. For example, say 239 students in Economics 201. Jul 24, 2014 · Functional diversity can be quantified using one single trait at a time or multiple traits (see the descriptions of multiple-indices in other page). The weighted mean is similar to an arithmetic mean (the most common type of average), where instead of each of the data points contributing equally to the final average, some data points contribute more than others. A weighted grade or score is average of a set of grades, where each grade (g) carries a different weight (w) of importance. an object containing the values whose weighted mean is to be computed. w: a numerical vector of weights the same length as x giving the weights to use for elements of x arguments to be passed to or from methods. Examples of how to use “weighted mean” in a sentence from the Cambridge Dictionary Labs. Instead of each data point contributing equally to the final mean, some data points contribute more "weight" than others. In simple terms, the category "total" will be equal to the sum of the scores in each grade item each multiplied by its grade weight, and that sum being finally divided by the sum of all weights. On the face of it, this does look as nice. RE: Geometric and weighted mean Perhaps it is worth pointing out that *an* average is a relatively arbitrary way of "summarising" a bunch of numbers into a single number. Sep 08, 2015 · How do I change my gradebook aggregation to ‘Weighted Mean of Grades’? By default, the Moodle gradebook aggregation (the way it adds your grade values) is ‘Simple Weighted Mean of Grades. When an assignment is “weighted”, it means there is a grade for that assignment. Catetan yén lamun kabéh beuratna sarua, weighted méan sarua jeung arithmetic mean. For example, if the chest is the target area, we might perform a set of barbell bench press, followed by a set of barbell incline press, and finished with a set of weighted parallel dips. A flow-weighted mean is the mean of a quantity after it is weighted proportional to a corresponding flow rate. The fact that x only gives one radiation field is the same as giving 0 radiation for the second field and so on, which means I do the following:. The mean of each area will be obtained using the formula: x = Î£x/N (Downie and Heat, 1970) The numerical findings of the study will be statistically analysed and interpreted using the frequency count. rm: a logical value indicating whether na values in x should be stripped before the computation proceeds. For example, in the county data set, population is a natural weighting. Most content comes from the ECPR Winter School in Methods and Techniques R course, that I had the pleasure of teaching this February. A similar procedure is used for a 10% trimmed mean. Select Weighted Goals as the plan goals type. Weighted Mean calculator for calculating the weighted mean statistics for the given set of data. DESCRIPTION. The F1 score can be interpreted as a weighted average of the precision and recall, where an F1 score reaches its best value at 1 and worst score at 0. A weighted grade or score is average of a set of grades, where each grade (g) carries a different weight (w) of importance. Unlike most credit card interest calculators, this calculator will calculate the current finance charge for each card, and then compute the credit card average APR using a weighted formula. This paper proposes a novel on-line portfolio selection strategy named “Confidence Weighted Mean Reversion ” (CWMR). There's one more skill you'll need to calculate weighted scores: A simple average, which in "math speak" is more properly called the mean. 3% then you are essentially implying a growth rate of POSITIVE 3. Find more details on making DIY. • So it is better to use WAPE for volume weighted MAPE and WMAPE for dollar weighted or Cost-weighted measures. What is a weighted KPI calculations For weighted KPI calculations, the base weight of each KPI is factored against the weighted counts of each KPI by using the following formulas. For this reason, consider using Mean Absolute Deviation (MAD) alongside MAPE, or Consider that even fast moving consumer goods companies these days to average MAPEs over multiple time series. (the "Gold Book"). Featured Services & News. Weighted Mean Formula (Table of Contents). Wondering what a weighted blanket is and what is the purpose of having one? Learn how weighted blankets can benefit sleep issues, anxiety, autism, ADHD, insomnia and more. These two measurements can be combined to give a weighted average. Follow this example use the following data set. The sample size weighted correlation may be used in correlating aggregated data Description. the weighted mean of is given by (4) Weighted means have many applications in physics, including finding the center of mass and moments of inertia of an object with a known density distribution and computing and electric and magnetic multipole moments of charge and current distributions, respectively. For instance if you have 3 objects, A,B and C. w: a numerical vector of weights the same length as x giving the weights to use for elements of x. Sincerely, Jacob. Weighted Shortest Job First (WSJF) is a prioritization model used to sequence jobs (eg. 1 Introduction The Least Mean Square (LMS) algorithm, introduced by Widrow and Hoff in 1959 [12] is an adaptive algorithm, which uses a gradient-based method of steepest decent [10]. The WACC is also the minimum average rate of return it must earn on its current assets to satisfy its shareholders, investors, or creditors. I have been working on a problem for the last year (in graph theory/algorithms). The weighted harmonic mean is the preferable method for averaging multiples, such as the price–earnings ratio (P/E), in which price is in the numerator. % % Example: % X = rand(3,5);. He has an entire dice set that almost always gets the best possible roll. Weighted average refers to the mathematical practice of adjusting the components of an average to reflect the importance of certain characteristics. Definition of weighted in the Definitions. What is the Weighted Average? The weighted average scoring model applies a "weight" to the matrix questions based on responses to the first item in a side-by-side matrix. wi(yi 0 1xi) 2. The weighted mean is similar to the arithmetic mean where instead of each of the data points contributing equally to the final average, some data points contribute more than others. Example sentences with "weighted mean", translation memory add example en The conclusion was that the only items differentiating the SIDS infants from the control infants were a "lower mean weight and height at birth, the previous occurrence of cyanosis [bluish skin and mucous membranes caused by lack of oxygen in the blood] or pallor during. Activity recording is turned off. 1 Introduction The Least Mean Square (LMS) algorithm, introduced by Widrow and Hoff in 1959 [12] is an adaptive algorithm, which uses a gradient-based method of steepest decent [10]. Often used to account for area changes between meridians at varying latitudes by using the cosine of the latitude as the weights. Besides the stock market example given above, another situation were weighed average is used is in grading. mean fitness of the population W(bar) The sum of the fitnesses of the genotypes of a population weighted by their proportions; hence a weighted mean fitness. Specifically, overtime is normally calculated at 1. Each grade item can be given a weight to change its importance in the overall mean. Weighted Shortest Job First (WSJF) is a prioritization model used to sequence jobs (eg. and Wilks, A. Weighted Mean: A mean where some values contribute more than others. Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. The weight of the category should be entered as a decimal, make sure that the sum of the weights equal 1. In simple terms, the category "total" will be equal to the sum of the scores in each grade item each multiplied by its grade weight, and that sum being finally divided by the sum of all weights. This calculator will calculate the weighted average APR for all of your credit cards that have a current balance. What does weighted mean mean? Information and translations of weighted mean in the most comprehensive dictionary definitions resource on the web. All or only selected records: You can either use all the points in the point theme for the analysis or only a selected subset of points. The weights cannot be negative. So let's have a look at the basic R syntax and the definition of the weighted. It is calculated according to the following formula: M = mark received in a course U = units of credit for a course. This article will show you how to use Excel's SUMPRODUCT and SUM functions individually and how to combine the two to calculate a weighted average. Formula: Where x is the repeating value. 0015948968 4 2 5442. Field {Case_Field} Field used to group features for separate mean center calculations. 15 * (73 + 80 + 85 + 88) +. …But sometimes, some data points…are more important than others. Trump talks Medicare in a retirement enclave where doctors are a golf-cart ride away. and Wilks, A. weighted definition: 1. Jun 07, 2016 · 61. Mar 18, 2017 · 2. A method of computing a kind of arithmetic mean of a set of numbers in which some elements of the set carry more importance (weight) than others. Paper 3: Issues in calculating average effect sizes in meta-analyses Dr. Metascore is a weighted average in that we assign more importance, or weight, to some critics and publications than others, based on their quality and overall stature. Slugging average is sometimes referred to as slugging percentage. But an equally weighted mean would be the pooled mewn and it expected value would be [65+73]/2. Section 2 formally formulates the on-. Under Medicare Advantage, the federal government still foots the. A weighted GPA is calculated by awarding additional points to classes that are considered more challenging than the basic curriculum. Free Arithmetic Mean (Average) Calculator - find the average of a data set step-by-step. The Benefits of a Weighted Sales Pipeline. 739 × 10-3 mm 2 /sec, SD = 0. Water-Quality Characteristics. Parameters: axis: {index (0), columns (1)} Axis for the function to be applied on. …If the professor had four exams,…and these were your four exam scores,…calculating your average would be easy, 80%. May 11, 2017 · The weighted mean is the weighted average. On the other hand, its weighted version is very useful for evaluating inequalities for definite integrals. The time-weighted formula is essentially a geometric mean of a number of holding-period returns that are linked together or compounded over time (thus, time-weighted). Among them, M55 showed a gene expression pattern consistent with behavioral changes after stress exposure, and the gene ontology analysis revealed that this was involved in nervous system development, gland. Data are classified using the Harmonized System of trade at the six- or eight-digit level. Sleep through the night and relieve anxiety with high-quality weighted blankets for adults from Weighting Comforts. Jul 24, 2014 · Functional diversity can be quantified using one single trait at a time or multiple traits (see the descriptions of multiple-indices in other page). 4) but have been unsuccessful in computing the weighted SD. Aug 29, 2013 · If such an effect is possible then the simplest and safest thing to do is compute the weighted sum for the m values in each of the n experiments. References. To calculate a weighted average in Excel, simply use the SUMPRODUCT and the SUM function. E(Z1)=65 and E(Z2)=73 The population mean is [2(65)+73]/3. It is challenging to achieve high weighted efﬁciency with low-power microinverters, typically because these devices are required to be low cost. How to Calculate Weighted Average Price Per Share Calculating your weighted average price per share can help you assess the performance of an investment that was made in several transactions. …Let's consider an academic course as our example. What is the uncertainty of the weighted average? What's the correct procedure to find the uncertainty of the average?. Weighted average definition, a mean that is computed with extra weight given to one or more elements of the sample. Another Tip: If number of boys and girls is same, i. May 01, 2012 · PowerPivot Weighted Average Measure Compared to Non-Weighted Average. The weighted average (or weighted mean, as statisticians like to call it) is easy to compute in SAS by using either PROC MEANS or PROC UNIVARIATE. If trim is non-zero, a symmetrically trimmed mean is computed with a fraction of trim observations deleted from each end before the mean is computed. - joran Jun 12 '12 at 4:35 3 @Frank Hover over the down triangle beneath the vote count next to your Q. If I use the following data. Math, I am in the 9th grade, and our math teacher is explaining "weighted averaging. title = "Amplitude-weighted mean velocity: Clinical utilization for quantitation of mitral regurgitation", abstract = "Objectives. Weighted blankets, sometimes referred to as gravity blankets, were once a tool of therapists and psychiatry clinics. The weighted mean is used a lot by teachers. How to use weighted in a sentence. net dictionary. It is useful in many situations e. Flow-weighted mean concentration. If you're seeing this message, it means we're having trouble loading external resources on our website. Myometrial Invasion in Endometrial Cancer: Diagnostic Accuracy of Diffusion-weighted 3. Weighted arithmetic mean. when they tried on their own, funded by WW. He has an entire dice set that almost always gets the best possible roll. In this lesson from Alanis Business Academy, we describe the weighted mean, review the equation to solve for the weighted mean, and actually solve for a weighted mean. If all the weights are equal, then the weighted mean equals the arithmetic mean (the regular "average" you're used to). So, we use a weighted average (weighted mean or scaled average) to give greater value to some data over other data. If this keyword is not present or is zero, then the mean is computed across all dimensions of the input array. Michael Ho Zheng Sun Jack Xin§. size }" if weights. 35 mg/L Flow Weighted C once tra i = 0. What is the acronym meaning/definition of CAC ?. We now see the mean as a weighted sum of the distinct values, where each value is weighted according to its proportion in the total list of numbers. Ranking, Matrix/Rating Scale, Multiple Choice, Multiple Textboxes, and Slider questions calculate an average or weighted average. Often used to account for area changes between meridians at varying latitudes by using the cosine of the latitude as the weights. Weighted average refers to the mathematical practice of adjusting the components of an average to reflect the importance of certain characteristics. (mean age, 57 years) who had. mean function in R, so far I couldn’t find a implementation of weighted. For weighted KPI calculations, the base weight of each KPI is factored against the weighted counts of each KPI by using the following formulas. n an average calculated by taking into account not only the frequencies of the values of a variable but also some other factor such as their variance. A weighted average is an average in which one element may contribute more heavily to the final result than another element. - joran Jun 12 '12 at 4:35 3 @Frank Hover over the down triangle beneath the vote count next to your Q. Among them, M55 showed a gene expression pattern consistent with behavioral changes after stress exposure, and the gene ontology analysis revealed that this was involved in nervous system development, gland. Apr 21, 2017 · However, anxiety disorders can cause crippling feelings of fear, worry, or restlessness. This is a correct assumption if the same technique is used to measure the same parameter repeatedly. If using aggregated data, the correlation of the means does not reflect the sample size used for each mean. 2 mg/L Flow Weighted Concentration = 0. wi(yi 0 1xi) 2. Weighted average refers to the mathematical practice of adjusting the components of an average to reflect the importance of certain characteristics. WMC is sampling-, scale-, and contrast-invariant, and is sparse on natural images. The weighted arithmetic mean (or weighted average) is used if one wants to combine average values from samples of the same population with different sample sizes: ¯ = ∑ = ∑ =. The monthly returns are then compounded to arrive at the annual return. His head was pounding, his body seemed to ache from head to toe, and there was a tightness in his chest that pressed on his lungs. Weighted Average Item Price Report (WAIPR) and the Regional and Statewide Average Awarded Price Report (RSWAAPR) The Weighted Average Item Price Report (WAIPR) and the Regional and Statewide Average Awarded Price Report (RSWAAPR) are reports produced using information from NYSDOT's Trns•Port BAMS⁄DSS. Weighted gene co-expression network analysis identified 60 characteristic modules that correlated with stress or the FKBP5 genotype. 0026132544 5 1 209. 03 Progressive Less than 0. It is also called weighted average. Tseng Department of Biostatistics Department of Human Genetics. Thus, the weighted mean makes it possible to find the average student grade in the case where only the class means and the number of students in each class are available. In other words, each value to be averaged is assigned a certain weight. Now, they have gone mainstream. Since we're all engineers, most students can figure out how this works at the end of the termbut how do you take it into account to calculate your current grade halfway through?. A weighted score or weighted grade is merely the average of a set of grades, where each set carries a different amount of importance. This is a correct assumption if the same technique is used to measure the same parameter repeatedly. Hi R experts, I need know how calculate a weighted mean by group in a data frame. Weighted voting. mean, part of R for Data Science: Lunchbreak Lessons. The experts in survey were estimating the organizations by. 03 Neutral 0. Section 2 formally formulates the on-. We will first create a Category which will use Weighted mean of grades. The Greedy Strategy for activity selection doesn’t work here as a schedule with more jobs may have smaller profit or value. Weighted Mean is a statistical method which calculates the average by multiplying the weights with its respective mean and taking its sum. If all the weights are equal, then the weighted mean is the same as the arithmetic mean. The average is calculated by adding a range of numbers together and then dividing this total by the number of values in the range. The solid lines are the weighted mean while the dashed lines are the standard mean. Featured Services & News. A weighted mean (or weighted average) is like an ordinary mean, but the observations don't contribute equally - more emphasis is placed on some data values than others; they are weighted by a bigger or smaller amount than 1/n. Given a numeric vector of data values, x, and another numeric vector of weights, w, the weighted mean is the sum of the data value times the weights divided by the sum of the weights. 'Mikhail' instead of just 'Mihail')?. His head was pounding, his body seemed to ache from head to toe, and there was a tightness in his chest that pressed on his lungs. This implies that we trim the lowest 5% of the data as well as the highest 5% of the data. Note that contrary to the weights w i in Eq. The weighted mean measures the average of the weighted data points. It is also called weighted average. Also called weighted mean. In a scenario where grades are weighted by category and the number of assignments in a category changes, no changes to the course points or syllabus would be necessary. What is a Weighted Mean? A weighted mean is a kind of average. Time-Weighted Return Formula. Meaning of weighted mean. A mean where some values contribute more than others. Input the above in your Ti-84 or TI-83 calculator Instructions on how to Create a List TI-84 | TI-83 tutorial. 631 × 10-3 mm 2 /sec, SD = 0. 03 Progressive Less than 0. If a professor decides to increase or decrease the workload based on the particular needs of any group of students, weighted grades make that easy. Here is the mean of 1, 2, 3 and 4: Add up the numbers, divide by how many numbers: Mean = 1 + 2 + 3 + 44 = 104 = 2. When totaling the individual values, each is multiplied by a weighting factor, and the total is then divided by the sum of all the weighting factors. Weighted means are often used for frequency data. These two measurements can be combined to give a weighted average. Weighted mean. Notice that the groups differ considerably in sample size. Mean: The arithmetic mean, also known as the simple mean or equal weighted mean. It is based on kernel weighted sample statistics such as the mean (Nadaraya-Watson estimator) but also standard deviation, skewness, kurtosis, deciles, etc. The above weighted average formula returns the value 849. Moving Average charts in JMP Each point on a Uniformly Weighted Moving Average (UWMA) chart, also called a Moving Average chart, is the average of the w most recent subgroup means (called “span”), including the present subgroup mean. Synonyms for weighted at Thesaurus. Generally the first item measures attributes like "Importance," "Need," or "Expectation". Input the above in your Ti-84 or TI-83 calculator Instructions on how to Create a List TI-84 | TI-83 tutorial. The area-weighted mean patch size, on the other hand, is a weighted mean, where the weights are based on the size of the patch. However, if you don’t want to spend big on Weighted belts, then you should absolutely go for Dark Iron Fitness which comes with all the basic features one could expect in Weighted belts. prepared and arranged in a way that is likely to produce a particular effect, usually an…. This method assumes that all of the trials have measured the outcome on the same scale. It is generally used to find average of variables that are expressed as a ratio of two different measuring units e. The T2-weighted sequence can be employed as a dual echo sequence. Weighted Mean. This has been a guide to Weighted Average in Excel. In calculating a weighted average, each number in the data set is. What does it mean republicans trying to phase out higher federal payments of medicare 3 Oct 2019. an object containing the values whose weighted mean is to be computed. a numerical vector of weights the same length as x giving the weights to use for elements of x. Next, obviously the weighted mean is $$\hat\mu=\sum_ip_ix_i,$$ and the variance:$$\hat\sigma^2=\sum_ip_i(x_i-\hat\mu)^2$$. Apr 21, 2017 · However, anxiety disorders can cause crippling feelings of fear, worry, or restlessness. By modifying sequence parameters such as repetition time (TR) and echo time (TE), for example, anatomical images can emphasize contrast between gray and white matter (e. Weighted mean The calculation of the mean discussed in the handout assumes that the standard deviation of each individual measurement is the same. VWAP is typically used with intraday charts as a way to determine the general direction of intraday prices. This is a correct assumption if the same technique is used to measure the same parameter repeatedly. weighted average w/ matlab. Chapter 3 Weighted Mean study guide by john_lindsey8 includes 43 questions covering vocabulary, terms and more. Definition - What does Weighted Average Cost of Capital (WACC) mean? The weighted average cost of capital represents a weighted average of the after-tax cost of debt and the cost of equity where the weighting is based on a company’s target debt-equity ratio, measured at market. If this keyword is present, then the mean is only calculated across a single dimension. SUMPRODUCT should be the sum of the products of the respective values and weights. Nov 29, 2019 · 10 intermittent fasting side effects that might mean it’s not a great fit for you These are the 6 full-body home exercises the Springbok women’s vice captain swears by World Aids Day: Could. Weighted Averages Date: 11/02/98 at 21:09:00 From: Jacob Smith Subject: Help with "weighted Averaging" Dr. Weighted gene co-expression network analysis identified 60 characteristic modules that correlated with stress or the FKBP5 genotype. Source Score, x Weight,w Homework 60 5% Midterm 75 35% Project 80 20% Speech 70 15% Final Exam 62 25% 2. The weighted arithmetic mean of a set of numbers X 1, X 2, , X N with respective weights of w 1, w 2, , w N is defined as: Example : For a statistics course, the final exam grade is weighted four times as much as each quiz score. It includes the product id and invoice id along with some other information. Column A shows all the student’s percentage scores he/she received on tests, quizzes, homework assignments, and participation. Creates a classification table, from raw data in the spreadsheet, for two observers and calculates an inter-rater agreement statistic (Kappa) to evaluate the agreement between two classifications on ordinal or nominal scales. Let us understand more with an example:. It is calculated according to the following formula: M = mark received in a course U = units of credit for a course. A mean where some values contribute more than others. 35 mg/L Flow Weighted C once tra i = 0. wRC+ takes the statistic Runs Created and adjusts that number to account for important external factors -- like ballpark or era. 739 × 10-3 mm 2 /sec, SD = 0. How to use weighted in a sentence. This method is sensitive to extreme observations (e. The arithmetic mean-geometric mean (AM-GM) inequality states that the arithmetic mean of non-negative real numbers is greater than or equal to the geometric mean of the same list. Here are the high-level steps for using weighted goals to manage a plan: Define goal IDs on the Goals page.


# [ASK] Is Expected Frequency Rounded Up or Down?

#### Monoxdifly

A die is tossed 100 times. What's the expected frequency that the number appears will be 4?

The probability is 1/6, so the expected frequency is 1/6 × 100, but that results in a fraction (16 2/3). Do we need to round it up or down? Is the answer 16 or 17?

#### romsek

MHF Helper
You don't need to round it at all. The correct answer is $\dfrac{50}{3}$

True you won't see 2/3 of a die but that doesn't matter. An expectation is an average and as such there's no reason to expect it must be an integer.

#### Monoxdifly

Okay then, thanks.

#### TKHunny

If you are forced to round, for whatever reason, you will need to decide exactly how to do that.

Typically, a simple up or down methodology will prove unsatisfactory as you will violate the definition of a probability distribution:

Down 2 dp
1/3 = 0.33
1/3 = 0.33
1/3 = 0.33
0.33 * 3 = 0.99 and that is NOT 1.00

Likewise, fudging (forced footing) proves unsatisfactory:

1/3 = 0.33
1/3 = 0.33
1/3 = 0.34

They are not really equal, are they.

Unless you are in a purely theoretical pursuit, you just have to make up your mind what is and is not suitable.

#### Monoxdifly

Oh well, no rounding then, thanks.


# How should I calculate $\lim_{n\rightarrow \infty} \frac{1^n+2^n+3^n+…+n^n}{n^n}$ [duplicate]

How should I calculate the below limit
$$\lim_{n\rightarrow \infty} \frac{1^n+2^n+3^n+...+n^n}{n^n}$$ I have no idea where to start from.

• If this question does not come out from you, then where did you get this question? – Megadeth Oct 12 '15 at 5:37
• The limit should at least bigger than $1 + e^{-1} + e^{-2} + \cdots = \frac{e}{e-1}$ as for all $n$, the last term is $1$, the second last is $\left(\frac{n-1}{n}\right)^n = (1- \frac 1n)^n$ which tends to $e^{-1}$. So on so forth. – user99914 Oct 12 '15 at 6:05
• From $\frac{x_1+x_2+\cdots+x_n}{n}\geq\sqrt[n]{x_1x_2\cdots x_n}$ we write $$(\frac1n)^n+(\frac2n)^n+\cdots+(\frac1n)^n\geq n\frac{n!}{n^n}\to e$$ – Nosrati Oct 12 '15 at 6:29
• @Maryam $n^n\sim e^nn!$, so $n\dfrac{n!}{n^n}$ does not approach $e$. – Quang Hoang Oct 12 '15 at 6:35
• Have you tried Stolz-Cesaro ? – Lucian Oct 12 '15 at 6:49

First we use an observation by @Stan in the comment. Note that as $(1 +\frac{x}{n})^n$ is increasing in $n$ whenever $|x|<n$,

$$\left(\frac{k}{n}\right)^n = \left(1 + \frac{k-n}{n}\right)^n \le e^{k-n},$$

(here we assume that $x:= k-n$ is fixed and varies the remaining two $n$'s. This sequence is increasing and tends to $e^{k-n}$, as $|x| = |k-n| < n$. See here). Then we have

$$\begin{split} \frac{1^n + 2^n + \cdots + n^n}{n^n} &= \sum_{k=1} ^n \left(\frac{k}{n}\right)^n \\ &\le \sum_{k=1}^n e^{k-n} \\ &= 1 + e^{-1} + e^{-2} + \cdots e^{1-n} \\ &\le \frac{1}{1-e^{-1}} = \frac{e}{e-1}. \end{split}$$ This implies

$$\limsup_{n\to \infty} \frac{1^n + 2^n + \cdots + n^n}{n^n} \le \frac{e}{e-1}.$$

On the other hand, fix $k$. Then for all $n >k$, we have

$$\begin{split} \frac{1^n + 2^n + \cdots + n^n}{n^n} &\ge \frac{(n-k)^n + (n-k+1)^n + \cdots + n^n} {n^n}\\ &= \left( 1 - \frac kn\right)^n + \left( 1 - \frac {k-1}n\right)^n + \cdots +1 \end{split}$$

Then for all $\epsilon >0$, there is $N\in \mathbb N$ so that

$$\left| \left( 1 - \frac {j-1}n\right)^n - e^{-(j-1)} \right| < \epsilon$$

whenever $n \ge N$ and for all $j = 1, 2 , \cdots, k+1$ (Note $k$ is fixed, so this $N$ can be found)

In particular, this implies

$$\frac{1^n + 2^n + \cdots + n^n}{n^n} \ge e^{-k} + e^{-(k-1)} + \cdots + 1 - (k+1) \epsilon.$$

Thus

$$\liminf_{n\to \infty} \frac{1^n + 2^n + \cdots + n^n}{n^n} \ge e^{-k} + e^{-(k-1)} + \cdots + 1 - (k+1) \epsilon.$$

Now let $\epsilon \to 0$ and then $k \to \infty$, we have

$$\liminf_{n\to \infty} \frac{1^n + 2^n + \cdots + n^n}{n^n} \ge \frac{1}{1-e^{-1}} = \frac{e}{e-1}.$$

This implies

$$\lim_{n\to \infty} \frac{1^n + 2^n + \cdots + n^n}{n^n} = \frac{e}{e-1}.$$

• Another proof for $e^{k-n} \geq (k/n)^n = e^{n \ln (k/n)}$: $\Leftarrow k-n \geq n \ln (k/n) \Leftarrow \frac{k}{n}-1 \geq \ln \frac{k}{n}$ $\Leftarrow$ for $x>0$, $x-1 \geq \ln x$ $\Leftarrow$ Let $y(x) = x-1-\ln x$, then the stationary point should satisfy $y'=1-\frac{1}{x}=0$; meanwhile $y''=x^{-2}>0$. Thus $y_{\min} = y(1) = 0$, for all $x>0$, $y(x) \geq 0$. – Stan Oct 12 '15 at 8:01
• Another proof for the upper bound: $$1^n+2^n+\cdots+(n-k-1)^n < \int_1^{n-k} x^n\,dx < (n-k)^{n+1}/(n+1) < (n-k)^n.$$ Thus when we take only the terms from $(n-k)^n$ to $n^n$ in the numerator, the neglected terms are at most $(n-k)^n/n^n$, which tends to $e^{-k}$ as $n\to\infty$. Now we have the limit sandwiched between two explicit functions of $k$; let $k\to\infty$. – Greg Martin Oct 12 '15 at 8:10
• Nice proof! +1 :) – ZFR Nov 21 '15 at 7:50


# Associativity of a binary operator

I am reading the book "A first course in abstract algebra", and i am reading the chapter called subgroups. It says that, for general situations we do not use "*" to denote the binary operation on a group, but we simply use addition symbol "+" or multiplication symbol ".". Then it says, we denote the product a.a.a.a.a...a for n factors by an. But i am confused here: is that always associative? For example, for 3 factors, a.a.a is a3 according to what book says, but are we sure that a.(a.a)=(a.a).a=a3 is always true? Thank you.

-
Do you know what "group" means? –  Chris Eagle Mar 14 '13 at 20:53
Yes, i do. Why? –  bigO Mar 14 '13 at 20:54
Then you know the answer to this question. –  Chris Eagle Mar 14 '13 at 20:54
This is why i am asking this, i must be missing something –  bigO Mar 14 '13 at 20:55
Note that not all binary operations need be associative. For example, take the integers under subtraction: $-4=(1-2)-3\neq 1-(2-3)=0$. –  user1729 Mar 15 '13 at 14:54

Recall: One of the key properties satisfied by all groups is that its binary operation is associative on the set defined by the group.

If you are referring to Fraleigh's text, see

Definition 4.1: "A group $\langle G, *\rangle$ is a set $G$, closed under a binary operation $*$, such that the following axioms of satisfied:

$\mathcal G_1$: For all $a, b, c \in G,$ we have $$(a*b)*c = a*(b*c)\tag{associativity of *}$$

Of course, $\mathcal G_2,\;\text{and}\;\mathcal G_3\;$ are crucial, as well: the existence of an identity element $e\in G$, and for each $g\in G$, its inverse, $g^{-1}$ is also in $G$, including the definitions of the identity and how we define the inverse of a group element.

-
Oh thanks, that's what i have been missing. –  bigO Mar 14 '13 at 20:55

Not only, As @amWhy noted, the binary operation is associative but also depend on how you show the binary operation, the figures of composition of elements varies: $$\cdot\longrightarrow a*b=a\cdot b$$ so $$\underbrace{a\cdot a\cdot a\cdot ...\cdot a}_{\large n\;times}=a^n~$$ And $$+\longrightarrow a*b=a+ b$$ so $$\underbrace{a+ a+ a+ ...+ a}_{\large n\;times}=na$$

-
Don't know why the downvote? +1 –  amWhy Mar 14 '13 at 21:09
Thank you! I did not downvote, just to let you know –  bigO Mar 14 '13 at 21:28
@amWhy: Thanks Amy for the edit. :-) –  Babak S. Mar 15 '13 at 5:32


# Win a coin game in 10th round

Two players are tossing a fair coin in one round. If it is heads, the first one gets a dollar from the second player. Otherwise, the first player gives a dollar to the second one. If both players have 6 dollars in the beginning of the game, what is the probability that the first player wins all the money exactly on 10th round.

• I am considering sample space to be 2^10; however, a friend of mine considers it to be 960. Whose idea is erroneous and why? Thanks. – Ulugbek Abdullaev Oct 26 '16 at 18:06
• The sample space is not as big as $2^{10}$, because the sequence $HHHHHHTTTT$ and $HHHHHHHHHH$ are considered exactly the same game (they quit playing after the sixth heads). Of course, if you think that they continue playing after one has lost just to "see what would happen", but without any money involved, and analyze those games, then the sample space has size $2^{10}$. It all depends on your interpretation. – Arthur Oct 26 '16 at 18:07
• @Arthur I got your point. Could you elaborate how to exclude those unnecessary? I'm just stuck.. – Ulugbek Abdullaev Oct 26 '16 at 18:41
• Hint: out of those ten rounds, how many Heads were there? How many Tails? We know the last one was $H$...what about the next to last? – lulu Oct 26 '16 at 19:04
• @BruceET It's very nearly the whole story. We see that we want $8$ Heads and $2$ Tails...there must be at least one $T$ in the first $6$ slots and and both $T$ must be in the first $8$. Easy to count. – lulu Oct 26 '16 at 21:58

If the coin is tossed 10 times, there could be wins at trials number 6, 8, and 10.

A win at the 6th requires six heads in a row (probability $.5^6 = 0.015625.$)

A first win at the 8th requires that exactly one of the first six tosses must be tails, followed by two heads (probability $6(.5)^8 = 0.0234375.$)

The simulation below confirms these two results (within simulation error), and suggests that the probability of a first win at the 10th toss must have probability about 0.0265 (two or three place accuracy). I will leave it to you use similar logic to find a combinatorial formula and the exact probability.

m = 10^6; frst.win = numeric(m)
for(i in 1:m)
{ toss = sample(c(-1,1), 10, rep=T)  # vector of 1's (Hs) and -1's (Ts)
cs = cumsum(toss)                  # 1st player's cumulative totals
frst.win[i] = match(6, cs) }       # toss on which cum tot first reaches 6
table(frst.win)/m
frst.win
6        8       10
0.015633 0.023540 0.026513


# What is $\gcd(0,0)$?

What is the greatest common divisor of $0$ and $0$? On the one hand, Wolfram Alpha says that it is $0$; on the other hand, it also claims that $100$ divides $0$, so $100$ should be a greater common divisor of $0$ and $0$ than $0$.

-
(o,o)? <- see the face scratching the head? – zerosofthezeta Sep 16 '13 at 4:57
It is typically not defined. – copper.hat Sep 16 '13 at 4:58
– anon Sep 16 '13 at 5:23

The word "greatest" in "Greatest Common Divisor" does not refer to being largest in the usual ordering of the natural numbers, but to being largest in the partial order of divisibility on the natural numbers, where we consider $a$ to be larger than $b$ only when $b$ divides evenly into $a$. Most of the time, these two orderings agree whenever the second is defined. However, while, under the usual order, $0$ is the smallest natural number, under the divisibility order, $0$ is the greatest natural number, because every number divides $0$.

Therefore, since every natural number is a common divisor of $0$ and $0$, and $0$ is the greatest (in divisibility) of the natural numbers, $\gcd(0,0)=0$.

-
Similarly $\gcd(0,n)=n$ for all $n\in\Bbb N$ (including $n=0$). – anon Sep 16 '13 at 5:22
Thanks, great answer! How did you figure this out? Where do mathematicians store such commonly agreed on, but not completely obvious definitions? When did people start defining gcd this way, I assume they didn't when Euclidean algorithm was invented 300BC? – Konstantin Weitz Sep 16 '13 at 6:55
For the most part, the partial order of divisibility coincides with the usual ordering wherever it is defined. So if $\le$ represents the usual ordering and $\vert$ represents the partial order of divisibility, then $x\vert y\Rightarrow x\le y$, except if $y=0$. Moreover, if $x$ is a common divisor of two non-zero natural numbers $a$ and $b$, then $x\le\gcd(a,b)\Rightarrow x\vert\gcd(a,b)$. So in most cases, you can define $\gcd(a,b)$ to be the greatest common divisor of $a$ and $b$, where 'greatest' refers to the usual ordering. That's what Euler did (and left $\gcd(0,0)$ undefined). – Donkey_2009 Sep 16 '13 at 11:55
Euclid, I mean.... – Donkey_2009 Sep 16 '13 at 14:50

I answered this already in a comment at MO: "The best way to think about this is that the "gcd" of two natural numbers is the meet of them in the lattice of natural numbers ordered by divisibility. Note that $0$ is the top element in the divisibility order. The meet of the top element with itself is itself. So $0 = \gcd(0, 0)$ is the answer. 'Greatest' is an unfortunate misnomer in this case."

The book Mathematics Made Difficult has a nice little section on this. It should perhaps better be called "highest common factor" (hcf).

-
You lost the race to William. – dfeuer Sep 16 '13 at 5:05
we all lost to him :) – DanielY Sep 16 '13 at 5:06
@dfeuer Well, I had answered the question already at MO. I wasn't racing. – user43208 Sep 16 '13 at 5:06
Win or lose, "the meet of [two numbers] in the lattice of natural numbers ordered by divisibility" is a definition of delightful pithiness. – Jordan Gray Sep 16 '13 at 11:00

Another way to think about this is ideals. The gcd of two natural numbers $a, b$ is the unique non-negative natural number that generates the ideal $\langle a, b \rangle$. So in this case, $\langle 0 ,0 \rangle$ is just the $0$ ideal so the gcd is $0$.

-

Defining $\gcd(a,b)$ for $\def\Z{\mathbf Z}a,b\in\Z$, to be the non-negative generator of the ideal $a\Z+b\Z$ gives $\gcd(a,0)=|a|$ for all $a$, including for $a=0$. Similarly one can define $\def\lcm{\operatorname{lcm}}\lcm(a,b)$ to be the non-negative generator of the ideal $a\Z\cap b\Z$, which gives $\lcm(a,0)=0$ for all$~a$ (note that since this is the only common multiple in this case, it is unlikely to provoke much discussion).

Adding these cases to the usual definitions of the $\gcd$ and $\lcm$ for nonzero integers causes no problems; all usual formulas remain valid. In fact, if one wants the rule $\gcd(xy,xz)=|x|\gcd(y,z)$ to hold for all integers $x,y,z$, one is forced to put $\gcd(0,0)=0$.

On the other hand, I don't think it is absolutely vital for mathematics to have $\gcd(0,0)$ defined, in the same way as $0+0$, $0\times0$ and $0^0$ need to be defined (and $0/0$ needs to be undefined) in order for the usual rules of algebra that one uses all the time to be valid. I think it would suffice to qualify the rule I cited by "$x\neq0$" if one wants to leave $\gcd(0,0)$ undefined; other rules like $\gcd(a,b)=\gcd(a,a-b)$ do not seem to equate $\gcd(0,0)$ with something else. The reason that leaving it undefined is not so dramatic is that when considering divisibility, $0$ is often excluded anyway; for instance it has to be put aside in the theorem of Unique Factorisation.

-

Simply said - this depends on your definition.

Clearly, if $d=\gcd(a,b)$, you require $d\mid a$, $d\mid b$, i.e., it is a common divisor.

But there are two possibilities how to express that it is greatest common divisor.

One of them is to require $$c\mid a \land c \mid b \Rightarrow c\le d$$ and the other one is $$c\mid a \land c \mid b \Rightarrow c\mid d.$$

Clearly, if you use the first definition, $\gcd(0,0)$ would be the largest integer, so it does not exists. If you use the second one, you get $\gcd(0,0)=0$. (Note that $0$ is the largest element of the partially ordered set $(\mathbb N,\mid)$.)

As far as I can say, the first definition appears in some text which are "for beginners"; for example here. (It was one of the first results from Google Books when searching for "gcd(0,0)".)

I would say that for students not knowing that $\mid$ is in fact a partial order, the first definition might feel more natural. But once you want to use this in collection with more advanced stuff (for example, g.c.d. as generator of an ideal generated by $a$ and $b$), then the second definition is better.

-
This helped. I still feel a little icky about (ℕ,∣) as a partial order, because 0∣0 feels weird to me, and this whole argument requires that reflexivity. – rampion Apr 8 at 0:46

In the general framework of integral domains (commutative rings with unity, without nontrivial zero-divisors), we define a greatest common divisor of two elements $a,b$ of an integral domain $R$ as any element $c\in R$ satisfying:

• $c$ divides both $a$ and $b$, that is, there are $x,y\in R$ such that $a=cx$ and $b=cy$.
• If $d\in R$ divides both $a$ and $b$, then $d$ divides $c$.

We write $c=\gcd(a,b)$ in this case. The definition implies that if $c,c^\prime=\gcd(a,b)$, then $c$ and $c^\prime$ are associates, that is $c=uc^\prime$ for some invertible element $u$ in $R$. This is equivalent to say that the principal ideals generated by $c$ and $c^\prime$ are the same. Therefore a non-ambiguous definition is as follows:

"$\gcd(a,b)$ is $\$ any minimal$\$ the minimum element in the family $\mathcal F=\{Rd: Rd\supseteq Ra+Rb\}$ of principal ideals containing $a$ and $b$, ordered by inclusion, wherever such minimum ideal exists."

Since $R0+R0=R0$, we see that $R0=0$, the trivial ideal of $R$, is the $\gcd$ of $0$ and $0$.

In general you cannot guarantee that $\gcd$s exist. A sufficient condition is your integral domain $R$ to be a UFD (Unique Factorization Domain).

-
Use \gcd instead of $GCD$. Also, ^\prime can be abbreviated all the way down to '. – dfeuer Sep 16 '13 at 5:11
I've tried editing it myself, but you've interrupted me twice, so I'll let you do it. – dfeuer Sep 16 '13 at 5:11
@dfeuer Thanks for the suggestion. By the way, that ' shortcut works in ordinary $\LaTeX$? – Matemáticos Chibchas Sep 16 '13 at 5:12
Yep! It even works in Plain $\TeX$! $x'''$ just takes four keystrokes (six if you count dollar signs). – dfeuer Sep 16 '13 at 5:16
anon- Not on my keyboard. On my keyboard, backtick is the key to the left of 1, and tilde is obtained by holding shift and pressing the hash key (which is next to Enter). In general, the location of punctuation characters varies in keyboards used in different countries. – Hammerite Sep 16 '13 at 9:21

From Wikipedia:

The greatest common divisor of $a$ and $b$ is well-defined, except for the case $a=b=0$, when every natural number divides them.

-
Well, this isn't really the right answer, is it? William got it right. – user43208 Sep 16 '13 at 5:22
All I'm saying is that Wikipedia got it wrong in this case (or at least it's misleading to suggest that $\gcd(0, 0)$ is not well-defined, because as has been clearly explained, it's perfectly well-defined and indeed it's $0$). – user43208 Sep 16 '13 at 5:32
The guy got his answer, that's the most important :) – DanielY Sep 16 '13 at 5:33

If we take Euclid's algorithm:

$\text{gcd}(a, b) = \left\{ \begin{array}{l l} a & \quad \text{if$b = 0$}\\ \text{gcd($b$,$a$mod$b$)} & \quad \text{otherwise} \end{array} \right.$

as the definition of GCD, then $\text{gcd}(a, 0) = 0$ for any $a$, because the stopping case of $b = 0$ is reached immediately. If $a = 0$, then we get $\text{gcd}(0, 0) = 0$.

So, it's possible that Wolfram Alpha obtains its result as a side effect of using Euclid's algorithm rather than deliberate thought as to what gcd(0, 0) should return. But it does fortunately coincide with William's “partial order of divisibility” explanation.

-


# Math Help - Stokes Theorem - double integral

1. ## Stokes Theorem - double integral

Use Stokes’ Theorem to evaluate $\int_c^.F \cdot dr$

C: is the boundary of the portion of $z = x^2 + y^2$ below z = 4, oriented downward,

$F = $

Can someone please check over my work thanks!

First I found N --> $N = \frac{<2x, 2y, -1>}{\sqrt{4x^2 + 4y^2 + 1^2}}$

Then i found $\bigtriangledown \times F = <0, 0, -1>$

from using the formula $\bigtriangledown \times F = $

Now $\bigtriangledown \times F \cdot N = \frac{1}{\sqrt{4x^2 + 4y^2 + 1^2}}$

Then $dS = {\sqrt{4x^2 + 4y^2 + 1}}dA$

So putting it all together....

$\int\int_R^. \frac{1}{\sqrt{4x^2 + 4y^2 + 1^2}} \cdot \sqrt{4x^2 + 4y^2 + 1}$

The square roots cancel and reduce to....

$\int\int_R^. 1 dA$

This double integral of 1 dA is equal to the Area of the Region

And using $z = x^2 + y^2$ and $z = 4$ we come up with $r^2 = 4 .... r = 2$

$A(R) = \pi r^2 = \pi(2^2) = 4\pi$

Does $4\pi$ look correct for the answer?

Thanks for looking

2. I've always disliked the notation $\vec{n}dS$ because used that unthinkingly results in doing two square roots which, just as you see here, cancel!

Instead think of $d\vec{S}$ as the "vector differential of surface area" and calculate it directly. We can write the surface $z= x^2+ y^2$ in a vector equation with x and y as parameter: $\vec{r}(x,y)= x\vec{i}+ y\vec{j}+ z\vec{k}= x\vec{i}+ y\vec{j}+ (x^2+ y^2)\vec{k}$. The derivatives with respect to x and y give two tangent vectors, $\vec{i}+ 2x\vec{k}$ and $\vec{j}+ 2y\vec{k}$. The cross product of those gives the "vector differential of surface area": $2x\vec{i}+ 2y\vec{j}- \vec{k}$ where I have chosen the order of multiplication to get a negative value for $\vec{k}$, "oriented downward".

You are correct that $\nabla\times \vec{F}= -\vec{k}$ so that $\nabla\vec{F}\cdot\vec{n} dS= \nabla\vec{F}\cdot d\vec{S}$[tex]= (0(2x)+ 0(2y)- 1(-1))dxdy= dxdy.

That gives $4\pi$, not $-4\pi$.

Your normal vector, $\frac{-2x\vec{i}-2y\vec{j}+ \vec{k}}{\sqrt{4x^2+ 4y^2+ 1}}$ was oriented upward, not downward.


## Palindromes

Problem 4 at Project Euler poses the following challenge:

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.

### A Naïve Approach

A naïve solution would be to multiply all the three-digit numbers by one another, pull out all the palindromes, and find the greatest:

var isPalindrome = function(n){
n = n.toString();
return n === n.split("").reverse().join("");
};

var findBiggest = function(){
var allProducts = [];
for (var n = 100; n < 1000; n++){
for (var m = 100; m < 1000; m++){
allProducts.push(m * n);
}
}
var palindromes = allProducts.filter(isPalindrome);
return Math.max.apply(null, palindromes);
};

But the naïve appraoch means making a huge-ass array with 810,000 numbers in it, consuming 3.09MiB of memory and taking many milliseconds to build. We can do better with a little number theory.

#### Don’t include obvious duplicates

$m \times n = n \times m$

Instead of starting m at 100 for each value of n, start it at n. This avoids duplicates and cuts array size roughly in half, to only 405,450 entries.

#### Don’t include multiples of 10

Observe that $n \times 10$ always ends in $0$. We don’t ordinarily write positive non-zero integers in decimal with leading zeros, so we can safely exclude all multiples of 10 from $n$ and $m$, saving us another 76,995 entries in allProducts, almost 19%, for a new total of 328,445 entries.

#### Assume the greatest palindrome has six digits

This is a pretty safe assumption in the instance the Project Euler problem describes, but may not be safe in other situations. Of our remaining 404,550 products of two three-digit decimal numbers, only 69,787 (17.25%) of them do not have six digits. It turns out these 17.25% include over 60% of the palindromes, but all we need is one six-digit palindrome in there to safely ignore the five-digit ones. $101,101 = 143\times707$ and has six digits; that’s enough to let us dismiss five-digit entries.

But how do we exclude five-digit products from our array without having to spend time calculating those products? We don’t. But limiting ourselves to condisering only six-digit products (actually, to products with an even number of digits) lets us do something nifty.

As it turns out, palindromic numbers with an even number of digits have a nifty property: they all share a common, easily identifiable factor.

Let $\mathbb{P}\subset\mathbb{N}$ be the set of palindromic numbers with $k+1$ digits $a_0...a_k$ in an arbitrary base $b:b\geq2$:

$\mathbb{P}=\left\{ n\in\mathbb{N}:n=\sum\limits_{i=0}^{k}a_ib^i\middle|a_i=a_{k-i}\right\}$

Note that $n$ is palindromic if and only if $a_i=a_{k-i}$. By way of example:

 $$$$\begin{split}987,789&=9(10^0)\\&+8(10^1)\\&+7(10^2)\\&+7(10^3)\\&+8(10^4)\\&+9(10^5)\end{split}$$$$ $$$$\begin{split}65,456&=6(10^0)\\&+5(10^1)\\&+4(10^2)\\&+5(10^3)\\&+6(10^4)\end{split}$$$$

Looks like a pattern! Turns out we can rewrite the sum like this, but only for palindromes with an even number of digits:

$n=\sum\limits_{i=0}^{\frac{k+1}{2}}a_i\left(b^i+b^{k-i}\right)\Big|k+1\text{ is even}$

Essentially, we pair up the digit $a_i$ with its matching digit $a_{k-i}$ and thereby only deal with half the digits. This doesn’t work with palindromes with an odd number of digits because of the pesky middle digit, which has no mate.

 $$$$\begin{split}987,789&=9(10^0+10^5)\\&+8(10^1+10^4)\\&+7(10^2+10^3)\end{split}$$$$ $$$$\begin{split}65,456&=6(10^0+10^4)\\&+5(10^1+10^3)\\&+4(10^2)\end{split}$$$$

For palindromes with an even number of digits, we can factor the addend:

$a_i(b^i+b^{k-i})=a_ib^i(1+b^{k-2i})$

Check it out! We can make $1+b^{k-2i}=0$ with modular arithmetic!

\begin{alignat*}{2}\begin{split}1+b^{k-2i}&=1-1^{k-2i}&\mod{b+1}\\&=1-1&\mod{b+1}\\&=0&\mod{b+1}\end{split}\end{alignat*}

Every palindrome with an even number of digits is evenly divisible by $b+1$, where $b$ is the radix. We’re working in decimal, so $b+1=11$.

We needn’t bother with any products but those that are divisible by 11. 11 being prime makes things easy. We'll only multiply $m\times n$ and push() the product to allProducts if at least one of $\lbrace m,n\rbrace$ is divisible by 11. This brings allProducts.length down to only 55,764, a reduction of over 93.1% from our original 810,000.

### Putting it All Together

All this makes for lots of savings in computation and storage, but it makes our program a lot uglier:

var isPalindrome = function(n){
n = n.toString();
return n === n.split("").reverse().join("");
};

var findBiggest = function(){
var allProducts = [];
var start, end, step;
for (var n = 101; n < 1000; n++){
if (n % 10){
if (n % 11){
start = 11*Math.ceil(n/11);
end = 11*Math.floor(1000/11);
step = 11;
} else {
start = n;
end = 1000;
step = 1;
}
}
for (var m = start; m < end; m+=step){
if (m % 10){
allProducts.push(m * n);
}
}
}
var palindromes = allProducts.filter(isPalindrome);
return Math.max.apply(null, palindromes);
};

Messy, but fast. The naïve version ran in 1,158.8ms, while this version runs in only 74.2ms.