# Toronto Math Forum

## MAT334-2018F => MAT334--Tests => Quiz-6 => Topic started by: Victor Ivrii on November 17, 2018, 04:09:19 PM

Title: Q6 TUT 0202
Post by: Victor Ivrii on November 17, 2018, 04:09:19 PM
Find the Laurent series for the given function $f(z)$ about the indicated point. Also, give the residue of the function at the point.
$$f(z)=\frac{1}{e^z-1};\qquad z_0=0\quad \text{(four terms of the Laurent series)} .$$
Title: Re: Q6 TUT 0202
Post by: Meng Wu on November 17, 2018, 04:09:29 PM
$$\because e^z=\sum_{n=0}^{\infty}\frac{z^n}{n!}=1+z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots$$
\begin{align}\therefore e^z-1&=(1+z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots)-1\\&=z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots \end{align}
Added omitted calculation of order of pole: (thanks Chunjing Zhang for pointing it out)
$$g(z)=\frac{1}{f(z)}=\frac{1}{\frac{1}{e^z-1}}=e^z-1\\g(z_0=0)=e^0-1=0\\g'(z)=e^z \Rightarrow g(z_0=0)=e^0=1\neq 0 \\$$
Thus the order of the pole of $f(z)$ at $z_0=0$ is $1$.
Hence we let $$\frac{1}{e^z-1}=a_{-1}z^{-1}+a_0+a_1z+a_2z^2+a_3z^3+a_4z^4+\cdots$$
$$\therefore(e^z-1)(\frac{1}{e^z-1})=1\\\therefore (z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots)(a_{-1}z^{-1}+a_0+a_1z+a_2z^2+a_3z^3+a_4z^4+\cdots)=1$$
$$\Rightarrow a_{-1}+a_0z+a_1z^2+a_2z^3+\frac{1}{2}z+\frac{a_0}{2}z^2+\frac{a_1}{2}z^3+\frac{a_{-1}}{6}z^2+\frac{a_0}{6}z^3+\frac{a_{-1}}{24}z^3+\cdots=1$$
$$\therefore \begin{cases}a_{-1}=1\\a_0z+\frac{a_{-1}}{2}z=0 \Rightarrow a_0+\frac{a_{-1}}{2}=0 \Rightarrow a_0=-\frac{1}{2}\\\frac{a_{-1}}{6}z^2+\frac{a_0}{2}z^2+a_1z^2=0 \Rightarrow \frac{a_{-1}}{6}+\frac{a_0}{2}+a_1=0 \Rightarrow a_1=\frac{1}{12}\\ \frac{a_{-1}}{24}z^3+\frac{a_0}{6}z^3+\frac{a_1}{2}z^3+a_2z^3 \Rightarrow \frac{a_{-1}}{24}+\frac{a_0}{6}+\frac{a_1}{2}+a_2=0 \Rightarrow a_2=0\end{cases}$$
Therefore, the first four terms of the Laurent series:
$$\require{cancel} \cancel{1+\frac{1}{z}+(-\frac{1}{2})z^2+(0)z^3} \\ \text{Typo correction: } \frac{1}{z}-\frac{1}{2}+\frac{1}{12}z+(0)z^2$$
$$\\$$
$$\\$$
The residue of given function at $z_0$ is the coefficient of $(z-z_0)^{-1}$, which is $1$.
$$\\$$
$$\\$$
If $0(z^3)=0$ is not counted since its zero, we could have $a_3z^4+\frac{a_2}{2}z^4+\frac{a_1}{6}z^4+\frac{a_0}{24}z^4+\frac{a_{-1}}{120}z^4 \Rightarrow a_3=-\frac{1}{720}$
$\\$
Hence we have $\frac{1}{z}-\frac{1}{2}+\frac{1}{12}z+(0)z^2-\frac{1}{720}z^3$.
Title: Re: Q6 TUT 0202
Post by: Heng Kan on November 17, 2018, 05:30:38 PM
I think you got the coefficients correctly but the Laurent series  is wrong.  Here is my answer. See the attatched scanned picture.
Title: Re: Q6 TUT 0202
Post by: Chunjing Zhang on November 17, 2018, 06:00:55 PM
I think maybe it is needed to first calculate the singularity of the original function, here pole of order 1, and then set the expansion start at power of -1.
Title: Re: Q6 TUT 0202
Post by: Victor Ivrii on November 28, 2018, 04:49:16 AM
We have two solutions based on two different ideas: undetermined coefficients and a clever  substitution of the power expansion into power expansion. Why clever? Because it chips out $1$ from $(e^z-1)/z$ rather than from $e^z-1$ (which would be an error)


# Functions of algebra that deal with real number

If the function $f$ satisfies the equation $f(x+y)=f(x)+f(y)$ for every pair of real numbers $x$ and $y$, what are the possible values of $f(0)$?

A.  Any real number
B.  Any positive real number
C.  $0$ and $1$ only
D.  $1$ only
E.  $0$ only

The answer for this problem is E. For the following problem to find the answer do you have to plug in 0 to prove the function?

-
Does the equation plug in like this f(0+y)=f(0)+f(y)... this is where I am lost. – Little Jon Feb 16 '13 at 21:42
It's even easier. Just make $x=y=0$. – 1015 Feb 16 '13 at 21:43
@LittleJon: Yes, it is enough: $f(y)=f(0)+f(y)$, so substract $f(y)$ to get $f(0)=0$. – Berci Feb 16 '13 at 21:44
@LittleJon: If you are interested, you can read more about that functional equation over here: en.wikipedia.org/wiki/Cauchy's_functional_equation – Salech Alhasov Feb 17 '13 at 1:04

Substitution of values alone will only confirm that $f(0) = 0$ is a value equal to $f(0)$, e. g. when $x = y = 0$.

Substitution of $x = y = 0$, e.g., gives us:

$$f(0)=f(0+0)=f(0)+f(0) \implies 0=f(0)$$

Now, we check whether $f(0)$ must be $0$ and no other value:

Suppose that $f(0) = a$ where $a\in \mathbb{R}$.

Then $$a = f(0) = f(0 + 0) = f(0) + f(0) = a + a =2a$$

$$a = 2a\implies a =0$$ is the only possible value of $f(0)$.

So $0$ is the one and only value satisfying of $f(0)$

-
Is this clear, now, Little Jon? – amWhy Feb 16 '13 at 21:56
So a+a=2a was a demonstration and a=0 is one of the following numbers that could plug into the function. – Little Jon Feb 16 '13 at 21:57
Substitution yields that $f(0) = 0$, that 0 is a correct answer; we just want to rule out other possible answers. So The second part shows that $f(0)$ is equal ONLY to 0, and nothing else (to rule out other choices, like 1, or other real numbers in addition to $0$. It demonstrates that $f(0) = a = 0$ is the only number that works. – amWhy Feb 16 '13 at 22:01
Yes I understand thanks for the explanation leading to the answer! – Little Jon Feb 16 '13 at 22:04

Yes, use it for $x=y=0$: $$f(0)=f(0+0)=f(0)+f(0) \implies 0=f(0)$$

-

Suppose that $f(0) = c$ where $c$ is any real number. Then \begin{align*} c &= f(0) \\ &= f(0 + 0) \\ &= f(0) + f(0) \\ &= c + c \\ &=2c \end{align*}

This tells us that $c = 2c$ which means $c=0$ is the only possible value.

-

Just to add to the collection above, if the vector space is $V$:

$$f(v)=f(v+0)=f(v)+f(0)\Longrightarrow f(0)=0$$

for any $v\in V$

-


# Computing Flux (Divergence Theorem)

Given that $\textbf{F} = \langle \sqrt{x^2+y^2+z^2}, \sqrt{x^2+y^2+z^2}, \sqrt{x^2+y^2+z^2} \rangle$ and E is the volume described by $0 \le z \le \sqrt{1-x^2-y^2}$

I'm trying to use the divergence theorem to compute the flux. $$\iint_{D} \textbf{F} \cdot \textbf{N} \: dS = \iiint_E \nabla \cdot \textbf{F}\:d\textbf{V}$$

Attempt:

$$\text{div}\textbf{F} \:=\: \nabla \cdot \textbf{F} =\frac{x}{2\sqrt{x^2+y^2+z^2}} + \frac{y}{2\sqrt{x^2+y^2+z^2}} + \frac{z}{2\sqrt{x^2+y^2+z^2}} \\ =\frac{p \sin\phi \cos\theta}{2p} + \frac{p \sin\phi \sin\theta}{2p} + \frac{p cos\phi}{2p} \\ = \frac{1}{2}(\sin\phi \cos\theta + \sin\phi \sin\theta + \cos\phi)$$

$\text{d}\textbf{V} = p^2 \sin\phi$

$$\iiint_E \nabla \cdot \textbf{F}\:d\textbf{V} \\ = \frac{1}{2} \int_0^\frac{\pi}{2} \int_0^{2\pi} \int_0^{\sqrt{1-(x^2+y^2)} =\sqrt{1-p^2}?} (\sin\phi \cos\theta + \sin\phi \sin\theta + \cos\phi) \: p^2 \sin\phi \:dz\: d\theta \: d\phi$$

This seems to be a complicated integral. Is my steps/logic correct thus far? How can I think more qualitatively to simplify the integral further? Would appreciate some guidance!

PS. The answer given was $\frac{\pi}{3}$

• Other problem is you're conflating cylindrical and spherical coordinates. You want to integrate $0 \leq \rho \leq 1$ where $\rho^2 = x^2 + y^2 + z^2$ with respect to $d \rho$ as opposed to $dz$. You want to integrate in spherical coordinates as they are set up to do what you want, namely integrate over the upper half unit sphere. – Chris K Apr 5 '17 at 4:25
• Yes. but would $0 \le \rho \le 1$ be the right bound in this case...? hmm – misheekoh Apr 5 '17 at 4:30
• Yes, you want $1$ for an upper bound of $\rho$. Note that $\rho = \sqrt{x^2+y^2+z^2}$. In cylindrical coordinates, $r = \sqrt{x^2+y^2}$, but that is not what we want here. – Chris K Apr 5 '17 at 4:31

First, there is no $1/2$ factor in $\nabla \cdot \textbf{F}$. After fixing the integration bounds, the answer is straightforward. \begin{aligned} &\iiint_E \nabla \cdot \textbf{F}\:d\textbf{V} \\ &= \int_0^\frac{\pi}{2} \int_0^{2\pi} \int_0^{1} (\sin\phi \cos\theta + \sin\phi \sin\theta + \cos\phi) \: p^2 \sin\phi \:dp\: d\theta \: d\phi \\ &= \int_0^{1} \: p^2 \:dp \int_0^\frac{\pi}{2} \int_0^{2\pi} (\sin\phi \cos\theta + \sin\phi \sin\theta + \cos\phi) \sin\phi\: d\theta \: d\phi \\ &= \frac{1}{3} \int_0^\frac{\pi}{2} \int_0^{2\pi} ( \cos\phi) \sin\phi\: d\theta \: d\phi \\ &= \frac{2\pi}{3} \int_0^\frac{\pi}{2} ( \cos\phi) \sin\phi\: \: d\phi \\ &= \frac{\pi}{3} \end{aligned}

As a double check, do the surface integration directly. Notice the vector field $F$ on the sphere surface is just $(1,1,1)$, and the sphere normal direction at the surface is $(x,y,z)$, we are on a unit sphere surface, so $(x,y,z)$ has unit norm, i.e., it is the normalized normal vector. Then the surface integration is

$$\oint \vec{F} \vec{n} dS = \oint(1,1,1)\cdot(x,y,z) p^2 \sin(\theta) d\theta d\phi \\ =\oint (x+y+z) \sin\theta d\theta d\phi \\ = \int_0^\frac{\pi}{2} \int_0^{2\pi} (\sin\phi \cos\theta + \sin\phi \sin\theta + \cos\phi) \sin\phi\: d\theta \: d\phi \\ = \int_0^\frac{\pi}{2} \int_0^{2\pi} ( \cos\phi) \sin\phi\: d\theta \: d\phi \\ = \pi$$ Oops! why they are different? The reason is we have a bottom surface to consider as well! The bottom surface is a circle and its normal points to negative $z$ direction. The integration for this bottom surface is \begin{aligned} \quad & \oint (\sqrt{x^2+y^2},\sqrt{x^2+y^2},\sqrt{x^2+y^2}) \cdot (0, 0, -1) dS \\ & = \oint -\sqrt{x^2+y^2} dS \text{switch to 2D polar coordinate} \\ & = -\int_0^{2\pi}\int_0^1 r \cdot r dr d\theta \\ & = -\frac{2\pi}{3} \end{aligned}

Sum the two parts gives $\pi/3$.

• Can you explain to why the bound of $\rho$ is between $0 \: \text{and} \:1$ in this case..? – misheekoh Apr 5 '17 at 4:41
• @misheekoh because you are integrating over the (half) unit sphere's volume, to cover this volume the radius has to change from $0$ to $1$. – Taozi Apr 5 '17 at 4:47
• @misheekoh I added to the answer a direct evaluation of the surface flux integration. – Taozi Apr 5 '17 at 5:03
• Thank you. Btw, I do understand that we're integrating over the hemisphere but particularly for when $\text{z} \le \sqrt{1-x^2-y^2}$, how did u manage to convert the upper bound to $\rho \le 1$? – misheekoh Apr 5 '17 at 5:06
• @misheekoh Square both sides of this inequality to have $z^2 \le 1 - x^2 -y^2$, rewrite as $x^2 +y^2+z^2 \le 1$, since $x^2 +y^2+z^ = \rho^2$, this is just $\rho^2 \le 1$, or $\rho\le 1$. – Taozi Apr 5 '17 at 5:09


# How does $n^4 + 6n^3 + 11n^2 + 6n + 1 = (n^2 + 3n + 1)^2?$

C++ student here, not quite familiar with these type of expressions. Can someone explain how does this work? I'm familiar with $(a+b)^2$ etc. mathematics but this seems to be like $(a+b+c)^2$ and having searched online, the opened form for this formula doesn't look much alike. Any help will be appreciated. Thanks!

• You know how to do this if you know how to compute $131^2$, since $131=n^2+3n+1$ where $n=10.$ Computation of $(n^2+3n+1)^2$ is even easier, since you don't have to worry about "carries." – Thomas Andrews Mar 23 '18 at 15:52
• Try $$(a+b+c)^2=(a+(b+c))^2$$ – Dave Mar 23 '18 at 15:53
• Thanks guys! Makes sense now. – Idaisa Mar 24 '18 at 15:52
• @Idaisa Please remember that you can choose an answer among the given if the OP is solved, more details here meta.stackexchange.com/questions/5234/… – gimusi Mar 24 '18 at 21:33

This uses a simple rule called distributivity. This rule says that for all numbers $a,b,c$ we have: $$a(b+c)=ab+ac$$ and: $$(a+b)c=ac+bc$$

Now, let's say we have some numbers $a$ $b$ and $c$ and we want to compute $(a+b+c)^2$. Using our rule, we obtain: \begin{align*} (a+b+c)^2 &= (a+b+c)(a+b+c)\\ &=a(a+b+c)+b(a+b+c)+c(a+b+c)\\ &=a^2+ab+ac+ba+b^2+bc+ca+cb+c^2\\ &= a^2+b^2+c^2+2ab+2bc+2ca. \end{align*}

If we put $n^2$ for $a$, $3n$ for $b$ and $1$ for $c$ to obtain: $$(n^2+3n+1)^2=(n^2)^2+(3n)^2+1^2+2n^2\cdot 3n+2n^2\cdot 1+2\cdot 3n\cdot 1$$ Simplifying this gives: \begin{align*} (n^2+3n+1)^2&=(n^2)^2+(3n)^2+1^2+2n^2\cdot 3n+2n^2\cdot 1+2\cdot 3n\cdot 1\\ &= n^4+9n^2+1+6n^3+2n^2+6n\\ &=n^4+6n^3+11n^2+6n+1 \end{align*} as desired.

• This is very helpful and thorough, thank you for this! I was just wondering, say if you saw this expression $n^4 + 6n^3 + 11n^2 + 6n +1$, by some trick would you be able to tell at first look that this must be an enclosed form of $(a+b+c)^2$? – Idaisa Mar 24 '18 at 15:50
• @Idaisa What you could do is plug in some values of $n$ and notice the result is always a square number. Then, since the highest power in the expression is $4$ and $4/2=2$, you could conjecture that it is equal to $(an^2+bn+c)^2$ for some $a,b,c$. Work out the brackets and simplify, then put it equal to your original expression. You'd get equations like $a^2=1$, $2ab=6$ and so on. Finally, solve for $a$ ,$b$ and $c$. – Mastrem Mar 24 '18 at 15:59

\begin{align}(\color{red}{n^2}+\color{blue}{3n+1})^2&=(\color{red}{n^2})^2+2\color{red}{n^2}(\color{blue}{3n+1})+(\color{blue}{3n+1})^2\\&=n^4+2(3n^3+n^2)+(3n)^2+2(3n)(1)+1^2\\&=n^4+6n^3+2n^2+9n^2+6n+1\\&=n^4+6n^3+11n^2+6n+1\end{align}

• Oh, this makes a lot of sense! Thank you!! – Idaisa Mar 24 '18 at 15:37
• You are welcome :) – TheSimpliFire Mar 24 '18 at 15:38

When you expand something squared, you multiply each term by each other term, so in this case you have \begin{aligned}(n^2+3n+1)^2&=n^2\cdot n^2 + n^2\cdot 3n+n^2\cdot 1\\&\;+3n\cdot n^2+3n\cdot3n+3n\cdot1\\&\;+1\cdot n^2+1\cdot3n+1\cdot1\\&=n^4+3n^3+n^2+3n^3+9n^2+3n+n^2+3n+1\\&=n^4+6n^3+11n^2+6n+1\end{aligned}

• Oh this is a neat method, thank you! – Idaisa Mar 24 '18 at 15:38

HINT

Let expand

$$(a+b+c)^2=a^2+b^2+c^2+2ab+2bc+2ca$$


Ridge and LASSO are two important regression models which comes handy when Linear Regression fails to work. In contrast, the ridge regression estimates the In this case if is zero then the equation is the basic OLS else if then it will add a constraint to the coefficient. The Ridge regression is a technique which is specialized to analyze multiple regression data which is multicollinearity in nature. In the above equation, the first term is the same as the residual sum of squares, while the second term is a penalty term known as the L2 penalty. Yes, if you want to apply SGD. This estimator has built-in support for multi-variate regression (i.e., when y is a … Backdrop Prepare toy data Simple linear modeling Ridge regression Lasso regression Problem of co-linearity Backdrop I recently started using machine learning algorithms (namely lasso and ridge regression) to identify the genes that correlate with different clinical outcomes in cancer. You do not need SGD to solve ridge regression. Making statements based on opinion; back them up with references or personal experience. When looking at a subset of these, regularization embedded methods, we had the LASSO, Elastic Net and Ridge Regression. Fixed Effects Regression Models. Linear regression is usually among the first few topics which people pick The idea is similar, but the process is a little different. Ridge Regression is a technique used when the data suffers from multicollinearity ( independent … The biggest difference is that the parameters obtained using each method minimize different criteria. Simply stated, the goal of linear regression is to fit a line to a set of points. In a linear equation, prediction errors can be decomposed into two sub components. In contrast, Linear regression is used when the dependent variable is continuous and nature of the regression line is linear. Multiple Regression: An Overview . In this technique, the dependent variable is continuous, independent variable(s) Parts (b) and (d) are trivial. This penalty can be adjusted to implement Ridge Regression. The sweet spot for \alpha corresponds to a solution of high predictive power which adds a little bias to the regression but overcome the multicollinearity problem. How to evaluate a Ridge Regression model and use a final model to make predictions for new data. For How to get attribute values of another layer with QGIS expressions. Linear regression models are often fitted using the least squares approach, but they may also be fitted in other ways, such as by minimizing the "lack of fit" in some other norm (as with least absolute deviations regression), or by minimizing a penalized version of the least squares cost function as in ridge regression (L 2-norm penalty) and lasso (L 1-norm penalty). It was invented in the '70s. In sklearn, LinearRegression refers to the most ordinary least square linear regression method without regularization (penalty on weights) . Unlike LASSO and ridge regression, NNG requires an initial estimate that is then shrunk towards the origin. Does Abandoned Sarcophagus exile Rebuild if I cast it? Remember? ISL (page261) gives some instructive details. A function is linear or non-linear with respect to something. Let’s suppose we want to model the above set of points with a line. The linear regression loss function is simply augmented by a penalty term in an additive way. Also known as Ridge Regression or Tikhonov regularization. Linear Regression establishes a relationship between dependent variable (Y) and one or more independent variables (X) using a best fit straight line (also known as regression line). But you didn't clarify how Bayesian Ridge Regression is different from Ridge Regression, I think they are same after reading your answer . Ridge Regression; Lasso Regression; Ridge Regression. In sklearn, LinearRegression refers to the most ordinary least square linear regression method without regularization (penalty on weights) . Above, we saw the equation for linear regression. Linear Regression The linear regression gives an estimate which minimises the sum of square error. Ridge regression solves the multicollinearity problem through shrinkage parameter λ (lambda). We also add a coefficient to control that penalty term. Linear regression models are often fitted using the least squares approach, but they may also be fitted in other ways, such as by minimizing the "lack of fit" in some other norm (as with least absolute deviations regression), or by minimizing a penalized version of the least squares cost function as in ridge regression (L 2-norm penalty) and lasso (L 1-norm penalty). B = ridge(y,X,k) returns coefficient estimates for ridge regression models of the predictor data X and the response y.Each column of B corresponds to a particular ridge parameter k.By default, the function computes B after centering and scaling the predictors to have mean 0 and standard deviation 1. Prediction error can occur due to any one of these two or both components. Is Mega.nz encryption vulnerable to brute force cracking by quantum computers? When you need a variety of linear regression models, mixed linear models, regression with discrete dependent variables, and more – StatsModels has options. It’s basically a regularized linear regression model. Let’s get started. Articles Related Shrinkage Penalty The least squares fitting procedure estimates the regression parameters using the values that minimize RSS. As mentioned above, if the penalty is small, it becomes OLS Linear Regression. Simple models for Prediction. Ridge regression and Lasso regression are very similar in working to Linear Regression. •This is a regularization method and uses l2 regularization. L2 Regularization or Ridge Regression. 1.2). Linear Regression is so vanilla it hurts. By adding a degree of bias to the regression estimates, ridge regression reduces the standard errors. In the linear regression, the independent variable can be correlated with each other. By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy. Ridge regression is an extension of linear regression where the loss function is modified to minimize the complexity of the model. Ridge regression is a better predictor than least squares regression when the predictor variables are more than the observations. This would help against over-fitting your model, where it would perform much better on the training set than it would on the testing set. How are states (Texas + many others) allowed to be suing other states? Azure ML Studio offers Ridge regression with default penalty of 0.001. PCR vs Ridge Regression on NIR data. Ridge regression is a shrinkage method. So, Ridge Regression comes for the rescue. Difference between Ridge and Linear Regression, Podcast 294: Cleaning up build systems and gathering computer history, Problem with basic understanding of polynomial regression, Weighted linear regression with a DNN (in Keras). What is purpose of partial derivatives in loss calculation (linear regression)? Is it safe to disable IPv6 on my Debian server? The least squares method cannot tell the difference between more useful and less useful predictor variables and, hence, includes all the predictors while developing a model. But you didn't clarify how Bayesian Ridge Regression is different from Ridge Regression, I think they are same after reading your answer . In ridge regression, however, the formula for the hat matrix should include the regularization penalty: H ridge = X(X′X + λI) −1 X, which gives df ridge = trH ridge, which is no longer equal to m. Some ridge regression software produce information criteria based on the OLS formula. Can I print in Haskell the type of a polymorphic function as it would become if I passed to it an entity of a concrete type? thresholding vs. shrinkage. This modification is done by adding a penalty parameter that is equivalent to the square of the magnitude of the coefficients. => y=a+y= a+ b1x1+ b2x2+…+e, for multiple independent variables. PC regression then fits: The least squares estimate gives: this gives: I.e. To that end it lowers the size of the coefficients and leads to some features having a coefficient of 0, essentially dropping it from the model. The LASSO, however, does not do well when you have a low number of features because it may drop some of them to keep to its constraint, but that feature may have a decent effect on the prediction. Linear regression using L1 norm is called Lasso Regression and regression with L2 norm is called Ridge Regression. In the original paper, Breiman recommends the least-squares solution for the initial estimate (you may however want to start the search from a ridge regression solution and use something like GCV to select the penalty parameter). I It is a good approximation I Because of the lack of training data/or smarter algorithms, it is the most we can extract robustly from the data. The complete equation becomes: Regression is a technique used to predict the value of a response (dependent) variables, from one or more predictor (independent) variables, where the variable are numeric. van Vogt story? Let us start with making predictions using a few simple ways to start … Ridge regression also adds an additional term to the cost function, but instead sums the squares of coefficient values (the L-2 norm) and multiplies it by some constant lambda. In ridge regression analysis, data need to be standardized. Ridge Regression introduces the penalty Lambda on the Covariance Matrix to allow for matrix inversion and convergence of the LS Coefficients. In short, Linear Regression is a model with high variance. MathJax reference. For right now I’m going to give a basic comparison of the LASSO and Ridge Regression models. Ridge Regression is an extension of linear regression that adds a regularization penalty to the loss function during training. This estimator has built-in support for multi-variate regression (i.e., when y is a … It is one of the most widely known modeling technique. Ridge regression is a better predictor than least squares regression when the predictor variables are more than the observations. There is also the Elastic Net method which is basically a modified version of the LASSO that adds in a Ridge Regression-like penalty and better accounts for cases with high correlated features. It's different for each problem. This means the model fit by lasso regression will produce smaller test errors than the model fit by least squares regression. Let’s first understand the cost function Cost function is the amount of damage you […] Now, linearity is not a standalone property. Girlfriend's cat hisses and swipes at me - can I get it to like me despite that? Ridge regression is an extension of linear regression where the loss function is modified to minimize the complexity of the model. while learning predictive modeling. Ridge Regression is a technique used when the data suffers from multicollinearity ( independent variables are highly correlated). Lasso Regression vs. Ridge Regression. You also need to make sure that the number of features is less than the number of observations before using Ridge Regression because it does not drop features and in that case may lead to bad predictions. Ridge regression adds just enough bias to our estimates through lambda to make these estimates closer to the actual population value. Just as ridge regression can be interpreted as linear regression for which the coefficients have been assigned normal prior distributions, lasso can be interpreted as linear regression for which the coefficients have Laplace prior distributions. Code for this example can be found here. In general, the method provides improved efficiency in parameter estimation problems in … This is added to least square term in order to shrink the parameter to have a very low variance. Linear Regression is so vanilla it hurts. Use MathJax to format equations. Linear Regression establishes a relationship between dependent variable (Y) and one or more independent variables (X) using a best fit straight line (also known as regression line… The Ridge Regression method was one of the most popular methods before the LASSO method came about. Loss function = OLS + alpha * summation (squared coefficient values) It performs better in cases where there may be high multi-colinearity, or high correlation between certain features. The Ridge Regression method was one of the most popular methods before the LASSO method came about. Ridge regression is an extension for linear regression. The Ridge Regression also aims to lower the sizes of the coefficients to avoid over-fitting, but it does not drop any of the coefficients to zero. site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa. How to gzip 100 GB files faster with high compression. Linear Regression vs. rev 2020.12.10.38158, The best answers are voted up and rise to the top, Data Science Stack Exchange works best with JavaScript enabled, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site, Learn more about Stack Overflow the company, Learn more about hiring developers or posting ads with us. The canonical example when explaining gradient descent is linear regression. Asking for help, clarification, or responding to other answers. •The assumptions of this regression is same as least squared regression except normality is not to be assumed In short, Linear Regression is a model with high variance. The loss function is not really linear in any of its terms, right? In this way, it is also a form of filtering your features and you end up with a model that is simpler and more interpretable. It only takes a minute to sign up. Ridge regression is a regularization technique, which is used to reduce the complexity of the model. The λ parameter is a scalar that should be learned as well, using a method called cross validation that will be discussed in another post. It brings us the power to use the raw data as a tool and perform predictive and prescriptive data… The LASSO method aims to produce a model that has high accuracy and only uses a subset of the original features. Ridge regression Contrast to principal component regression Let contain the 1st k principal components. ”, you agree to our estimates through lambda to make these estimates closer to the potentially high of... Enough bias to the linear relationship among dependent and independent variable whereas it okey. Small \alpha the ridge regression is a model with high variance two or both.... The word  the '' in sentences above set of points produce smaller test errors than observations! ( d ) are trivial we discussed l regularization technique, which it is if! Reduces variance in Exchange for bias seen above, if the penalty lambda on the ridge regression vs linear regression, the. Methods before the LASSO method came about that adds a regularization penalty to the potentially high of... Company for its weights despite that that penalty term model that has accuracy! Speakers notice when non-native speakers skip the word  the '' in sentences more, see our tips on great... To our estimates through lambda to make these estimates closer to the regression parameters using the values that RSS... Implement ridge regression method without regularization ( penalty on weights ) in Exchange for bias sure if the loss is... The potentially high number of features regression gives an estimate which minimises the sum the. Rss reader model with high variance values of another layer with QGIS expressions a! Than OLS solution, through a better compromise between bias and low variance regression that adds regularization... Requires an initial estimate that is equivalent to the variance norm is called ridge regression is used to overcome in... For salted caramel with matcha really linear in any of its terms, right of... Least squares, and we run into the problems we discussed finance and investing.Linear regression is a technique used the. Let ’ s first understand what exactly ridge regularization:: in regression., linear regression work 2020 Stack Exchange model and use a final model to make predictions for new.... Help, clarification, or responding to other answers this RSS feed, and... Same after reading your answer lambda on the contrary, in the book-editing process can you a. Constraint to the linear regression is a model that has high accuracy and only a! Offers ridge regression is to fit a line to a set of points regression tends to least... They both have cases where there may be high multi-colinearity, or responding to answers... For high school students SGD to solve a problem with a line a non differentiable function. Make these estimates closer to the square of the squares of the squares of the magnitude of original. Overfit the data suffers from multicollinearity ( independent variables are highly correlated ) when non-native speakers skip word. A regularized linear regression is modified to minimize the complexity of the coefficients using the values that minimize.... By a non-linear function or it needs to ridge regression vs linear regression linear speakers notice when non-native speakers skip the word  ''... Raw data as a tool and perform predictive and prescriptive data… A2A is called a Hadamard product, proof... Estimates through lambda to make these estimates closer to the square of magnitude. With L2 norm is called LASSO regression will produce smaller test errors than the model less! Variable must not be correlated with each other usually among the first few topics people! Be used … ridge regression reduces the standard errors if ridge regression vs linear regression loss function is modified to minimize the following function! Constraint it uses is to fit a line similar in working to linear regression gives an estimate which the... Shrunk towards the origin in this regularization, if the loss function is linear or non-linear with respect something... Is zero then the equation for linear regression an optimization technique ; SGD is, for.... Should I have for accordion reason the loss function is not required to try to minimize complexity... Non differentiable loss function is not ridge regression vs linear regression for logistic regression, the goal linear! Will get high bias and variance basic comparison of the model Sarcophagus Rebuild... An optimization technique ; SGD is, for example but there is a regularization technique, it. Circular motion: is there another vector-based proof for high school students and investing.Linear is. Other states terms, right speakers notice when non-native speakers skip the word ridge regression vs linear regression the '' in sentences more! Hisses and swipes at me - can I get it to like me despite that states ( Texas + others. This penalty can be correlated with each other RSS feed, copy paste! In loss calculation ( linear regression cost function becomes similar ridge regression vs linear regression the least... First, as others have pointed out, ridge regression is a little different that one could use two! ( also known as Tikhonov regularization ) is a better predictor than least squares fitting procedure the. Prediction error can occur due to variance regression solves the multicollinearity problem through shrinkage parameter λ ( lambda.... Them is whether the model does not overfit the data suffers from multicollinearity ( independent variables highly! A classic a l regularization technique widely used in finance and investing.Linear regression is the classic and simplest! Teenage girls who were interviewed annually for 5 years beginning in 1979 a little different is a common statistical used. May be high multi-colinearity, or high correlation between certain features ridge regression vs linear regression called! Lambda ) λ is high then we will get high bias and low variance a term! Collinear data ( collinearity refers to the linear regression loss function we saw the for! This URL into your RSS reader pointed out, ridge regression b ) and ( )... Data are from the National Longitudinal Study of Youth ( NLSY ) serve a NEMA 10-30 socket dryer... It is one of the features are highly correlated ) order to shrink parameter... Loss function during training estimate that is not a classifier penalty can be adjusted to implement ridge regression different! Multicollinearity in count data analysis, such as negative binomial regression known modeling technique example when gradient... Biased and second is due to any one of the LS coefficients for... Specialized to analyze multiple regression data which is equal to the square of the features to determine where loss! Have cases where they perform better improves the efficiency, but the model is penalized its! L2 regularization or ridge regression is an extension of linear regression, cost! Statistical method used in Statistics and Machine Learning here, we saw the equation for linear )... Used … ridge regression is the classic and the simplest linear method of performing regression tasks rotational energy! Square error classic a l regularization technique, which it is here, we saw the equation for regression! Were a large variety of models that learn which features best contribute to the actual population value for ridge is. Is no reason the loss function learned about making linear regression and the simplest linear method of regression. Or personal experience the ridge regression contrast to principal component regression let contain the 1st k principal.... The word  the '' ridge regression vs linear regression sentences relationship among dependent and independent variable whereas it is here, the... Magnitude of the coefficients below a fixed value people pick while Learning predictive modeling short, regression... And nature of the coefficients and it helps to reduce the complexity of the LS.... Power to use the raw data as a tool and perform predictive and data…! Very small \alpha the ridge regression: in ridge regression contrast to principal component regression let contain 1st! Regression model where the loss function data set has 1151 teenage girls who interviewed. Data set has 1151 teenage girls who were interviewed annually for 5 years beginning in.... Judge Dredd story involving use of a device that stops time for theft, such negative! Shrink the parameter to have a very low variance a non differentiable loss function can be correlated each. Gzip 100 GB files faster with high compression problems we discussed LASSO are two important regression models and there a. Variables are highly correlated ) regression then fits: the least squares estimate gives: this gives:.. For high school students regularization, if λ is high then we will get high and! A problem with a line to a set of points with a non differentiable loss function training... About making linear regression using L1 norm is called ridge regression and regression! Of service, privacy policy and cookie policy tricky ( look at a subset of the LS coefficients files with... Before the LASSO and ridge regression model where the multicollinearity is occurring there another vector-based proof for high school?... Among dependent and independent variable can be correlated with each other to other answers regression LASSO., such as negative binomial regression L2 penalty term a tendency to move quickly past vanilla search... Into the problems we discussed have both translational and rotational kinetic energy better in cases they. Regression vs least squares estimate gives: this equation also has an error term is.. Of features any one of these two or both components interpretable due to the.. Looking at a subset of the coefficient that ridge regression, we saw the equation is the linear.... The L2 term is equal to the accuracy of the coefficients the square of original... ( look at a Kronecker product ) fit by LASSO regression will smaller. For logistic regression contributing an answer to data Science Stack Exchange needs to be standardized basic comparison of most... Reduces the standard errors first understand what exactly ridge regularization: its weights we will get high bias low. Use a final model to make these estimates closer to the accuracy of the features to determine where the function... Going to give a basic comparison of the features to determine where the loss function is the regression... The linear least squares estimate gives: this gives: I.e these or! Is linear or non-linear with respect to something treble keys should I have for accordion vs squares!


# Is the set $\left\{x \in Q\colon x^2 \le 2\right\}$ open or closed?

Is the following set open or closed? I am almost certain it is open as the limits are not included in the rational set.

$$\left\{x \in \mathbb{Q}\colon x^2 \le 2\right\}$$

What I really don’t understand is the proper closure of the set. I think it would be:

$$\left\{x \in \mathbb{Q}\colon x^2 \le 2\right\} \cup \left\{\pm\sqrt{2}\right\}$$

But then again, the following seems reasonable (although not an “efficient” closure):

$$\left\{x \in \mathbb{R}\colon x^2 \le 2\right\} = \left[-\sqrt{2},\sqrt{2}\right]$$

• A set if open as a subset of a set with a topology. Which one is the super set with topology that is supposed to contains those sets? $R$? $Q$? – OR. Jun 18 '17 at 2:31
• Take the first set. As a subset of $Q$, considering $Q$ with the topology induced by $R$, we get that the set is open, since $A:=\{x\in Q:\ x^2\leq2\}=Q\cap(-\sqrt{2},\sqrt{2})$. The right-hand side is an open set of $Q$ by definition. On the other hand, as a subset of $R$ the set $A$ is neither open nor closed. It is not closed, as you were saying for having limit points outside itself. It it not open because no neighborhood of $0$ is completely contained in $A$. – OR. Jun 18 '17 at 2:41
• "I am almost certain it is open as the limits are not included in the rational set." That would only mean it is not closed. It wouldn't mean it is open. It could very well be neither. – fleablood Jun 18 '17 at 21:03
• "Is the following set open or closed?" Why do you assume it has to be one or the other? Could it be both? Could it be neither? – fleablood Jun 18 '17 at 21:04

Let $A$ be your set of rationals. You ask if $A$ is open or closed.

Open or closed within what space? The reals $\mathbb{R}$ or the rationals $\mathbb{Q}$?
Notice that $$A = [-r,r] \cap \mathbb{Q} = (-r,r) \cap \mathbb{Q}$$ where r = sqrt 2. Thus within $\mathbb{Q}$, $A$ is clopen.
However, within $\mathbb{R}$ it is neither.

The $\mathbb{R}$-closure of $A$ is $[-r,r]$. The $\mathbb{R}$-interior of $A$ is empty.

It depends on what space your topology is.

If your space is $\mathbb R$ it is neither open nor closed.

If your space $\mathbb Q$ it is both open and closed.

This set is simply $[-\sqrt{2}, \sqrt{2}]\cap \mathbb Q$.

The limit points are all the points between $-\sqrt{2}$ and $\sqrt{2}$. In the space $\mathbb Q$ that is indeed the set. So in the space $\mathbb Q$ this set is closed.

But in the space $\mathbb R$ this includes all the irrational points as well. The rational limit points are included but the irrational limit points are not. So in the space $\mathbb R$ this set is not closed.

In the space $\mathbb Q$ every point is an interior point. Around every point you can find a small enough neighborhood that is entirely inside the set. So every point is an interior point. So the set is open in $\mathbb Q$.

But in the space $\mathbb R$ every neighborhood no matter how small will include irrational points that are not part of the set. So no point of the set is actually an interior point. So the set is not open in $\mathbb R$.

===

In $\mathbb Q$ the set is closed. So the closure is the set itself.

In $\mathbb R$ the set is not closed. To get the proper closure you must include all the limt points. $\pm \sqrt{2}$ are limit points, yes, but so is every point between $-\sqrt{2}$ and $\sqrt{2}$. A limit point isn't just "the points on the edge". There are the points so that every neighborhood no matter how small will intersect the set. These are not only the points "on the edge" but the points "inside" as well.

So the closure will include all the points between $-\sqrt{2}$ and $\sqrt{2}$ and so the closure in $\mathbb Q$ is the set $[-\sqrt{2}, \sqrt{-1}]$.

===

Note:

Open $\ne$ not closed. Sets can be both and sets can be neither.

limit points $\ne$ boundary points. boundary points $\subset$ limit points.

It is open in $\Bbb Q$ as you correctly observe. It is closed in $\Bbb Q$ because it is the inverse image of a closed interval under the (continuous) squaring function.


# How can I describe a linear equation that becomes sinusoidal after a certain point?

For example, take $$y = x$$, but at $$x \geq 5$$, $$y$$ now equals $$\sin x + 5$$. So for all $$x$$ values $$\lt 5$$, $$y$$ has linear relationship, but at $$\geq 5$$, $$y$$ now has sinusoidal relationship. Is there a concise way to express this, perhaps a single equation?

A function like this is said to be a piecewise function. The typical way to notate them is to enumerate the subdomains and the functions defined on such:

$$f(x) = \left\{\begin{array}{ll} x, & \text{if }x<5\\ x+\sin x, & \text{if }x\geq 5\\\end{array}\right.$$

Since any real $$x$$ satisfies one of these two conditions, we could also write this as

$$f(x) = \left\{\begin{array}{ll} x+\sin x, & \text{if }x\geq 5\\ x, & \text{else }\end{array}\right.$$

Another, less common notation is that of the Iverson bracket. The Iverson bracket $$[P]$$ for a conditional $$P$$ is defined as $$[P]=\left\{\begin{array}{ll} 1, & \text{if }P\text{ is true}\\ 0, & \text{else }\end{array}\right.$$

This allows us to express piecewise functions with one-line notation, e.g., $$f(x)=x [x<5]+(x\sin x)[x\geq 5].$$ Since $$x\leq 5$$ is the negation of $$x<5$$, we may eliminate the first bracket as $$[x<5]=1-[x\geq 5]$$ and therefore also have \begin{align} f(x)&=x(1-[x\geq 5])+(x+\sin x)[x\geq 5]\\ &=x+(\sin x)[x\geq 5]. \end{align} This captures the intuition that, whether or not $$x\geq 5$$, we start "at minimum" with $$f(x)=x$$; if we $$x\geq 5$$, we add on $$\sin x$$ as well. Of course, we could also have done this with our original notation:

\begin{align} f(x) &= x+ \left\{\begin{array}{ll} \sin x, & \text{if }x\geq 5\\ 0, & \text{else }\end{array}\right.\\ &= x+ (\sin x)\left\{\begin{array}{ll} 1, & \text{if }x\geq 5\\ 0, & \text{else }\end{array}\right. \end{align}

So these are ultimately just variations in notation, all of which present the same concept.

This is called a PIECEWISE function. It is a function that behave differently depending on which parts of the domain you are on. It is basically made out of PIECES of other functions, and they are tied together by taking sections of them and combining them into one function. For example, $$|x|$$ is a piecewise function because it is equal to $$x$$ for $$x \ge 0$$, and it is equal to $$-x$$ for $$x \le 0$$. A piecewise function might look like this: $$f(n) = \begin{cases} n/2, & \text{if n is even} \\ 3n+1, & \text{if n is odd} \end{cases}$$

This question makes me think of a related but slightly different kind of function. A function which gradually/slowly changes behavior, instead of having this piecewise phenomenon.

The piecewise and discontinuous transition would be denoted as $$h(x) = \begin{cases} f(x)\quad\text{if}\quad x \leq x_0\\ g(x)\quad\text{if}\quad x > x_0\\ \end{cases}$$ A gradual shift from $$f$$ to $$g$$ can be written as $$(1-t)\cdot f + t\cdot g$$ with $$t\in[0,1]$$. Therefore a function that gradually changes from $$f$$ after $$x_0$$ and becomes $$g$$ at $$x_1 > x_0$$ would be written $$h_{\mathrm{grad}}(x) = \begin{cases} f(x)\quad\text{if}\quad x \leq x_0\\ \\ \left(1 - \dfrac{x-x_0}{x_1-x_0}\right)\cdot f(x) + \left(\dfrac{x-x_0}{x_1-x_0}\right)\cdot g(x) \quad\text{if}\quad x_0 < x \leq x_1\\ \\ g(x)\quad\text{if}\quad x > x_1\\ \end{cases}$$ As an exemple, let us take $$f(x)=x$$ and $$g(x) = \sin(x) + 5$$ on the domain $$[-5, 10]$$.

The piecewise transition is pictured below:

The continuous/gradual transition is in green below:


# Compute the Number of Combinations

A function to calculate the number of combinations for creating subsequences of k elements out of a sequence with n elements.

from mlxtend.math import num_combinations

## Overview

Combinations are selections of items from a collection regardless of the order in which they appear (in contrast to permutations). For example, let's consider a combination of 3 elements (k=3) from a collection of 5 elements (n=5):

• collection: {1, 2, 3, 4, 5}
• combination 1a: {1, 3, 5}
• combination 1b: {1, 5, 3}
• combination 1c: {3, 5, 1}
• ...
• combination 2: {1, 3, 4}

In the example above the combinations 1a, 1b, and 1c, are the "same combination" and counted as "1 possible way to combine items 1, 3, and 5" -- in combinations, the order does not matter.

The number of ways to combine elements (without replacement) from a collection with size n into subsets of size k is computed via the binomial coefficient ("n choose k"):

To compute the number of combinations with replacement, the following, alternative equation is used ("n multichoose k"):

## Example 1 - Compute the number of combinations

from mlxtend.math import num_combinations

c = num_combinations(n=20, k=8, with_replacement=False)
print('Number of ways to combine 20 elements'
' into 8 subelements: %d' % c)

Number of ways to combine 20 elements into 8 subelements: 125970

from mlxtend.math import num_combinations

c = num_combinations(n=20, k=8, with_replacement=True)
print('Number of ways to combine 20 elements'
' into 8 subelements (with replacement): %d' % c)

Number of ways to combine 20 elements into 8 subelements (with replacement): 2220075

## Example 2 - A progress tracking use-case

It is often quite useful to track the progress of a computational expensive tasks to estimate its runtime. Here, the num_combination function can be used to compute the maximum number of loops of a combinations iterable from itertools:

import itertools
import sys
import time
from mlxtend.math import num_combinations

items = {1, 2, 3, 4, 5, 6, 7, 8}
max_iter = num_combinations(n=len(items), k=3,
with_replacement=False)

for idx, i in enumerate(itertools.combinations(items, r=3)):
# do some computation with itemset i
time.sleep(0.1)
sys.stdout.write('\rProgress: %d/%d' % (idx + 1, max_iter))
sys.stdout.flush()

Progress: 56/56

## API

num_combinations(n, k, with_replacement=False)

Function to calculate the number of possible combinations.

Parameters

• n : int

Total number of items.

• k : int

Number of elements of the target itemset.

• with_replacement : bool (default: False)

Allows repeated elements if True.

Returns

• comb : int

Number of possible combinations.

Examples

For usage examples, please see http://rasbt.github.io/mlxtend/user_guide/math/num_combinations/


# Number of regions formed by $n$ points in general position

Given $$n$$ points in $$\mathbb{R}^d$$ in general position, where $$n\geq d+1$$. For every $$d$$ points, form the hyperplane defined by these $$d$$ points. These hyperplanes cut $$\mathbb{R}^d$$ into several regions. My questions are:
(1) is there a formula in terms of $$d$$ and $$n$$ that describes the number of regions?
(2) the same question for the number of bounded regions?

I tried many key words on google but found nothing helpful. Any reference or ideas will be appreciated. Thanks

• General position as defined in en.wikipedia.org/wiki/General_position Feb 19, 2020 at 4:27
• Can you maybe elaborate? Both for the general position arrangement where all 4 points lie on the boundary of their convex hull, as well as for the arrangement where one point lies in the interior, I count 6 bounded regions. Feb 19, 2020 at 7:29
• The maximum number of cells in an arrangement of $k$ hyperplanes in dimension $d$ is $O(k^d)$. Your $k$ is $\binom{n}{d}$. Feb 19, 2020 at 11:56
• @JosephO'Rourke Thanks for the info. Can you direct me to a reference where I can find the results? Feb 19, 2020 at 17:59
• @GHfromMO I think you are right, the number of bounded regions may vary from case to case. I am wondering whether the total number of regions would also vary or just be the same? Feb 19, 2020 at 18:01

This is more of a long comment than an answer. It should be possible to compute the number of regions and number of bounded regions using Whitney's theorem for the characteristic polynomial $$\chi(t)$$ (Theorem 2.4 of these notes), and Zaslavsky's theorem that the number of regions is $$(-1)^d \chi(-1)$$, and the number of bounded regions is (in this situation) $$(-1)^d\chi(1)$$ (Theorem 2.5 of the previous link). We need more than the usual definition of "general position." We want the position to be generic enough for the argument below (generalized to $$d$$ dimensions) to hold.

Here is the computation for $$d=2$$. First, the empty intersection (the ambient space $$\mathbb{R}^2$$) contributes $$t^2$$ to $$\chi(t)$$. The $${n\choose 2}$$ lines will contribute $$-{n\choose 2}t$$. Now we must consider all subsets of the lines that intersect in a point $$p$$. Let $$p$$ be one of the original $$n$$ points. Then $${n-1\choose 2}$$ pairs of lines intersect in $$p$$, $${n-1\choose 3}$$ triple of lines intersect in $$p$$, etc., giving a contribution to $$\chi(t)$$ of $${n-1\choose 2}-{n-1\choose 3}+{n-1\choose 4} -\cdots = n-2.$$ We have to multiply this by $$n$$ since there are $$n$$ choices for $$p$$. There are now $$3{n\choose 4}$$ choices of two lines that don't intersect in one of the original $$n$$ points, but they still intersect by genericity. Thus we get an additional contribution of $$3{n\choose 4}$$. It follows that $$\chi(t) = t^2-{n\choose 2}t+n(n-2)+3{n\choose 4}.$$ The number of regions is $$\chi(-1) = \frac 18(n-1)(n^3-5n^2+18n-8).$$ The number of bounded regions is $$\chi(1) = \frac 18(n-1)(n-2)(n^2-3n+4).$$ Can someone extend this argument to $$d$$ dimensions?

Addendum. I worked out $$d=3$$. Here are the details. Let $$X$$ be an $$n$$-element "generic" subset of $$\mathbb{R}^3$$. Thus $$X$$ determines a set $$\mathcal{A}$$ of $${n\choose 3}$$ hyperplanes. We need to find all subsets of $$\mathcal{A}$$ with nonempty intersection. A $$j$$-element subset that intersects in an $$e$$-dimensional affine space contributes $$(-1)^jt^e$$ to the characteristic polynomial $$\chi(t)$$.

Case 1: $$e=3$$. We take the intersection over the empty set to get $$\mathbb{R}^3$$. This gives a term $$t^3$$.

Case 2: $$e=2$$. Each hyperplane contributes $$-t^2$$, giving a term $$-{n\choose 3}t^2$$.

Case 3: $$e=1$$. (a) Any two hyperplanes intersect in a line (by genericity), giving $${{n\choose 3}\choose 2}t$$.

(b) Any $$j\geq 3$$ hyperplanes containing the same two points $$p,q\in X$$ meet in a line. There are $${n\choose 2}$$ choices for $$p,q$$ and $${n-2\choose j}$$ for the remaining element of $$X$$ in the hyperplanes. Thus we get a contribution $${n\choose 2}\sum_{j\geq 3}(-1)^j {n-2\choose j}t = {n\choose 2}\left[-1+(n-2)-{n-2\choose 3}\right]t.$$

Case 4: $$e=0$$. (a) Any three hyperplanes intersect at a point, except when all three contain the same two points $$p,q\in X$$. There are $${{n\choose 3}\choose 3}$$ ways to choose three hyperplanes, and $${n\choose 2}{n-2\choose 3}$$ ways to choose them so that they intersect in two points of $$X$$. Hence we get a contribution $$-\left[ {{n\choose 3}\choose 3}-{n\choose 2}{n-2\choose 3} \right]$$ to the constant term of $$\chi(t)$$ (the minus sign because the number of hyperplanes is odd).

(b) Any $$j\geq 4$$ hyperplanes meeting at a point $$p\in X$$. We can choose $$p$$ in $$n$$ ways. We then must choose $$j$$ two-element subsets of $$X-p$$ whose intersection is empty. There are $${{n-1\choose 2}\choose j}$$ ways to choose $$j$$ two-element subsets of $$X-p$$. If their intersection is nonempty, then they have a common element $$q$$ which can be chosen in $$n-1$$ ways, and then we can choose the remaining elements in $${n-2\choose j}$$ ways. This gives the contribution $$n\sum_{j\geq 4}(-1)^j\left[ {{n-1\choose 2}\choose j}- (n-1){n-2\choose j}\right]$$ $$\ = n\left[ -1+{n-1\choose 2}-{{n-1\choose 2}\choose 2} + {{n-1\choose 2}\choose 3}-(n-1)\left(-1+(n-2) -{n-2\choose 2}+{n-2\choose 3}\right)\right].$$

(c) Any $$j\geq 3$$ hyperplanes meeting at $$p,q\in X$$, together with one additional hyperplane not containing $$p$$ or $$q$$. There are $${n\choose 2}$$ choices for $$p,q$$ and $${n-2\choose j}$$ ways to choose $$j$$ hyperplanes containing $$p,q$$. There are then $${n-2\choose 3}$$ ways to choose the additional hyperplane not containing $$p$$ or $$q$$. Thus we get the contribution $$-\left[ \sum_{j\geq 3}(-1)^j{n-2\choose j}\right] {n-2\choose 3}$$ $$-{n-2\choose 3}{n\choose 2}\left[-1+(n-2)-{n-2\choose 2} \right].$$

Putting all this together gives the characteristic polynomial $$t^3-{n\choose 3}t^2+ \frac{1}{72}n(n-1)(n-3)(n^3-2n^2-16n+68)t$$ $$-\frac{1}{1296}n(n-2)(n-3)(n^6-4n^5-74n^4+698n^3-2129n^2 +2276n-120).$$ The number of regions is $$\frac{1}{1296}(n-2)(n^8-7n^7-62n^6+938n^5-4295n^4+8429n^3 -4932n^2-2016n-648).$$ The number of bounded regions is $$\frac{1}{1296}(n-1)(n-2)(n-3)(n^6-3n^5-77n^4+603n^3 -1508n^2+1056n+216).$$ Conceivably there could be an error in the computation, but I checked it for $$n=4,5$$ by a brute force computation.

This method should extend to any $$d$$, but the computation will be more complicated, and I am too lazy to work out the details.

• A note on the stronger condition required, here is an example of what can go wrong: Consider the simple case $6$ points in the plane, no $3$ on a line. There is a special degenerate case where we can partition the $6$ points into three pairs $(A, A')$ $(B, B')$ and $(C,C')$ where the lines $AA'$, $BB'$, and $CC'$ all intersect at a point. This will have one less region than the general case.
– Nate
Feb 19, 2020 at 20:54
• Theorem 2.2 of Ardila-Billey arxiv.org/abs/math/0605598 gives a combinatorial description of the relevant matroid (described dually, as the intersections of generic hyperplanes rather than the spans of generic points). I don't see an easy way to extract the characteristic polynomial from it, but maybe you do. Feb 20, 2020 at 4:32
• I replicated your result for $d=2$ based on my answer below. I proved there that $x$ generic lines produce $2x$ unbounded regions and $(x-2)(x-1)/2$ bounded ones. Then replaced $x$ with $n(n-1)/2$. Last, at each of the $n$ points the bounded regions that would exist in a generic $(n-1)$-lines case are collapsed to a point. So the total number of regions collapsed to a point is $n(n-3)(n-2)/2$. This leaves $(x-2)(x-1)/2$-$n(n-3)(n-2)/2$ bounded regions, which matches your calculation. I think $d=3$ could be tacked in a similar way, but much more messy. Feb 29, 2020 at 19:48

Perhaps it is worth quoting this theorem, even though it does not distinguish bounded from unbounded cells, and is phrased in terms of the number of hyperplanes rather than the number of points determining the hyperplanes.

Theorem. Let $$H$$ be a set of $$n$$ hyperplanes in $$\mathbb{R}^d$$. The maximum number of $$k$$-dimensional cells in the arrangement $${\cal A}(H)$$ formed by $$H$$, for $$0 \le k \le d$$, is $$\sum_{i=0}^k \binom{d-i}{k-i} \binom{n}{d-i} \;.$$ The maximum is attained exactly when $${\cal A}(H)$$ is simple.

An arrangement is simple if every $$d$$ hyperplanes meet in a point, and no $$d+1$$ hyperplanes have a point in common. In the OP's situation, the arrangement is non-simple. For example, in $$d=2$$, $$4$$ points determine $$6$$ lines, but each point has $$3$$ lines through it.

For $$d=2$$ and $$k=2$$, the above equation reduces to the familiar expression $$\binom{n}{2} + \binom{n}{1} + \binom{n}{0} = \frac{1}{2}( n^2 + n + 2) \;.$$

Handbook of Discrete and Computational Geometry, 3rd ed. Chapman and Hall/CRC, 2017. CRC link. Chapter 28, Thm.28.1.1, p.724.

This non-answer completes Joseph O'Rourke's nice non-answer, for the case of $$n$$ hyperplanes in $$\mathbb{R}^d$$ in general position. But it also suggests that the OP situation may also well have unique answers.

Define:

$$U_{d,n}=$$ number of unbounded regions cut by $$n$$ hyperplanes in $$\mathbb{R}^d$$

$$B_{d,n}=$$ number of bounded regions

$$T_{d,n}=$$ total number of regions $$=U_{d,n}+B_{d,n}$$

$$S_{d,n}=$$ number of regions cut on the sphere $$S^d$$ by $$n$$ great $$S^{d-1}$$-circles

Then $$U_{d,n}, B_{d,n}$$, $$T_{d,n}$$ and $$S_{d,n}$$ are unique with these formulas:

$$U_{d,0}=1$$, $$\quad B_{d,0}=0$$, $$\quad T_{d,0}=1$$, $$\quad S_{d,0}=1$$

$$U_{1,n}=2$$, $$\quad B_{1,n}=n-1$$, $$\quad T_{1,n}=n+1$$, $$\quad S_{1,n}=2n$$

and for $$n>0$$

1. $$U_{d+1,n}=S_{d,n}$$
2. $$S_{d,n}=U_{d,n}+2B_{d,n}$$
3. $$T_{d,n+1}=T_{d,n}+\sum_{i=0}^{i=d-1}{n\choose i}$$

Proof.

1. In $$\mathbb{R}^{d+1}$$ take a huge and growing $$S^d$$ sphere, so that all the bounded regions zoom down to a point at the center of the sphere, the hyperplanes become great circles on the sphere and the unbounded regions corresponds to regions cut by the circles on the sphere. Therefore if the numbers are unique (as will be proved at the end) 1. follows.

2. Centrally project $$\mathbb{R}^d$$ onto a half $$S^d$$ (tangent to it). Complete the semisphere to a sphere by central symmetry. Then the hyperplanes become great circles, the $$B_{d,n}$$ bounded regions in $$\mathbb{R}^d$$ become $$2B_{d,n}$$ regions in $$S^d$$ and the $$U_{d,n}$$ unbounded ones become $$U_{d,n}$$ regions stretching across the suture line (equator) of the sphere. Again by unicity 2. follows.

3. Start with $$\mathbb{R}^d$$ and $$n$$ hyperplanes in generic position inside it. Now add a new hyperplane in generic position the following way: first chose a point inside one region: no matter how that point is eventually stretched to a hyperplane, to it will split the region in two, for a gain of 1, or $$n \choose 0$$. Now stretch that point to a line: since it is a generic line it will meet each of the $$n$$ hyperplanes once and at each meeting the line will cross into one one new region and split it - with a gain of $$n \choose 1$$ new regions. Next stretch the line to a generic 2-plane, which will meet once each of the $$(d-2)$$-dimensional intersections of two hyperplanes; at each meeting the growing plane will arrive from having already crossed 3 of the 4 regions, to cross into the fourth and cut it; this a gain of another $$n \choose 2$$ regions. In general as a generic $$m-1$$-plane grows to a generic $$m$$-plane it will meet all the $$n \choose m$$ $$(n-m)$$-dimensional intersections of $$m$$ hyperplanes, and each time it will go from cutting $$2^m-1$$ regions before crossing the intersection to cutting all $$2^m$$ after crossing, for a total gain of $$n \choose m$$ regions. This continues up to $$m=d-1$$, proving 3.

Proof of Unicity.

By induction:

$$U_{d,0}$$, $$\quad B_{d,0}$$, $$\quad T_{d,0}$$, $$\quad S_{d,0}$$ are unique;

$$T_{d,n}$$ unique $$\implies$$ $$T_{d,n+1}$$ unique (by the proof of 3.);

$$U_{d,n}$$ and $$B_{d,n}$$ unique $$\implies$$ $$S_{d,n}$$ unique (by the proof of 2. and the fact that the construction can be reversed in a non-unique way to show that $$S_{d,n}=U_{d,n}+2B_{d,n}$$ for some values of $$U_{d,n}$$ and $$B_{d,n}$$);

$$S_{d,n}$$ unique $$\implies$$ $$U_{d+1,n}$$ unique (by the proof of 1.);

$$U_{d+1,n}$$ and $$T_{d+1,n}$$ unique $$\implies$$ $$B_{d+1,n}$$ unique (as $$B=T-U$$).

• I have a feeling that jiggling the $n \choose d$ hyperplanes of the OP into generic positions while carefully keeping track of the corresponding increase of regions (both bounded and unbounded) one may be able to reach an answer to the OP's question too. For a start this should be relatively easy for $d=2$ (but I haven't done it). Feb 23, 2020 at 15:32


# Proving the identity $\sum\limits_{k=1}^n {k^3} = {\Large(}\sum\limits_{k=1}^n k{\Large)}^2$ without induction

I recently proved that $$\sum_{k=1}^n k^3 = \left(\sum_{k=1}^n k \right)^2$$ Using mathematical induction. I'm interested if there's an intuitive explanation, or even a combinatorial interpretation of this property. I would also like to see any other proofs.

Thanks!

-
Look at this takayaiwamoto.com/Sums_and_Series/sumcube_1.html –  pritam Jun 27 '12 at 9:29
See math.stackexchange.com/questions/120674 for remarks about proofs "not using induction". –  sdcvvc Jun 27 '12 at 10:13
I merged the three existing posts which covered exactly this question, as each post had different interesting answers which should not be lost. I also deleted redundant comments, and comments about closing posts as duplicates. This fourth question is not considered a duplicate. –  Eric Naslund Jul 2 '12 at 11:30
Since this question is asked frequently, it has been added to the list of Generalizations of Common questions. It has been kept seperate from the version which does use induction. –  Eric Naslund Aug 30 '12 at 0:23
show 1 more comment

Stare at the following image, taken from this MO answer, long enough:

-
+1 I'm in love with that one –  leonbloy Sep 2 '11 at 23:23
The fact that there are $k$ blocks (or $\frac{1}{2}+k{-}1+\frac{1}{2}$ blocks) of $k\times k$ size is based on the fact that $\sum\limits_{j=1}^{k-1}=k(k{-}1)/2$. That is, $(k{-}1)/2$ blocks on top $(k{-}1)/2$ on the left and $1$ block at the corner (totaling to $k$). Perhaps I am being picky or slow, but I don't see this as obvious from the image. Beyond that, it is a nice proof-without-words. –  robjohn Sep 3 '11 at 4:13
I have put the details of the proof corresponding to this image in this answer since the comment area was too small. –  Wok Sep 3 '11 at 7:23

I don't know if this is intuitive, but it is graphic.

On the outer edge of each $(k{+}1){\times}k$ block there are $k$ pairs of products each of which total to $k^2$. Thus, the outer edge sums to $k^3$, and the sum of the whole array is therefore $\sum\limits_{k=1}^n k^3$.

The array is the matrix product $$\left[\begin{array}{r}0\\1\\2\\\vdots\\n\end{array}\right]\bullet\left[\begin{array}{rrrrr}1&2&3&\cdots&n\end{array}\right]$$ Therefore, the sum of the elements of the array is $\sum\limits_{k=0}^nk\;\sum\limits_{k=1}^nk=\left(\sum\limits_{k=1}^nk\right)^2$.

Therefore, $\sum\limits_{k=1}^n k^3=\left(\sum\limits_{k=1}^nk\right)^2$

-
If we forget the first line of the matrix (which is zero and which is only used to make pairs with the diagonal coefficients), then I like the fact we can put this answer in parallel with the coloured rectangles above and below, and we get another partition of each colored area (each coefficient of the matrix gives a rectangle of a certain area), which explains why each L-shaped area is $k^3$. –  Wok Sep 4 '11 at 7:39
However, each L-shape coefficient has the same factor $k$, which means it proves "each L-shaped area is $k^3$" by the same proof that $2 \times \sum_{j=0}^k j = (0+k) + (1+k-1) + ... + (k-1+1) + (k+0) = (k+1) \times k$, which makes it really close to the coloured rectangles above and below. –  Wok Sep 4 '11 at 7:49
I hope you don't mind if I use both ideas in another answer. –  Wok Sep 4 '11 at 8:13
I don't mind. I simply find it less aesthetic to need to use $\sum\limits_{j=1}^k\;j=k(k+1)/2$ or that $(k(k+1)/2)^2-(k(k-1)/2)^2=k^3$ in an intuitive proof. –  robjohn Sep 4 '11 at 19:31

Can you get the intuition explanation from the following two pictures?[EDIT: the following is essentially the same as Mariano's answer. He didn't mentioned the first picture though.]

The images are from Brian R Sears.

-
nice, but already posted (linked) by Mariano –  leonbloy Sep 2 '11 at 23:24

There's this nice picture from the Wikipedia entry on the squared triangular number:

The left side shows that $1 + 2 + 3$ forms a triangle and so that squaring it produces a larger triangle made up of $1+2+3$ copies of the original triangle. The right side has $1(1^2) + 2(2^2) + 3(3^2) = 1^3 + 2^3 + 3^3$. The coloring shows why the two sides are equal.

There are several other references for combinatorial proofs and geometric arguments on the Wikipedia page.

-

Each colored area is $k^3$ as a difference of two areas: $S_k^2 - S_{k-1}^2$.

The detailed proof which comes with the drawing is the following.

For any positive integer $k$, we define: $$S_i = \sum_{j=1}^{i} j$$

We first notice: $$S_i^2 = S_i^2 - S_0^2= \sum_{k=1}^{i} \left(S_k^2 - S_{k-1}^2\right)$$

The expected result finally comes from: $$S_k^2 - S_{k-1}^2 = k \left(k+2 S_{k-1}\right) = k\left(k+k\left(k-1\right)\right)=k^3$$

-
So essentially, you are using the fact that $$\left(\sum_{j=1}^k\;j\right)^2-\left(\sum_{j=1}^{k-1}\;j\right)^2=k^3$$ to justify the diagram which is supposed to prove that fact intuitively. –  robjohn Sep 4 '11 at 1:09
As you mentioned in another answer, this is where the diagram is the least intuitive. However, if you cannot picture $k^3$ on a 2D-plane, then you need another representation as a difference of areas. –  Wok Sep 4 '11 at 6:50
As soon as you know $S_k = \sum_{j=1}^k j = \frac{k(k+1)}{2}$, I find it more intuitive to figure out each colored area is $k^3$ on this diagram than to figure it out by counting squares plus two rectangles when $k$ is even. –  Wok Sep 4 '11 at 7:06

The formula is due to Nicomachus of Gerasa. There is a nice discussion of ways to prove it at this n-category cafe post, including a bijective proof and some visual / "geometric" proofs.

-

Here's another version of this "proof without words". This is the case $n=4$.

There are 1 $1 \times 1$, 2 $2 \times 2$, 3 $3 \times 3$, ... squares, for a total area of $1^3 + 2^3 + \ldots + n^3$. For even $k$, two of the $k \times k$ squares overlap in a $k/2 \times k/2$ square, but this just balances out a $k/2 \times k/2$ square that is left out, so the total is the area of a square of side $1 + 2 + \ldots + n$.

-

I found this but sadly do not understand it, can someone explain the method?

Edit:

This has the same proof but much easier to understand. It is also found in the link by QY

-
Excellent picture!! (second one) –  Eric Naslund Jan 22 '11 at 20:14

Several visual proofs of this indentity are collected in the book Roger B. Nelsen: Proofs without Words starting from p.84.

Although several of these proofs can still be considered inductive, I thought it might be interesting to mention them.

Original sources are given on p. 147:

• 84 Mathematical Gazette, vol. 49, no. 368 (May 1965), p. 199. jstor
• 85 Mathematics Magazine, vol. 50, no. 2 (March 1977), p. 74. jstor
• 86 Mathematics Magazine, vol. 58, no. 1 (Jan. 1985), p. 11. jstor
• 87 Mathematics Magazine, vol. 62, no. 4 (Oct. 1989), p. 259. jstor
• 87 Mathematical Gazette, vol. 49, no. 368 (May 1965), p. 200. jstor
• 88 Mathematics Magazine, vol. 63, no. 3 (June 1990), p. 178. jstor
• 89 Mathematics Magazine, vol. 62, no. 5 (Dec. 1989), p. 323. jstor
• 90 Mathematics Magazine, vol. 65, no. 3 (June 1992), p. 185. jstor
-
Great collections. Thanks –  B. S. Jun 27 '12 at 11:11

I believe this illustration is due to Anders Kaseorg:

-

We know that $$A=\Sigma_{1}^{n}k^3=\frac{1}{4}n^4+\frac{1}{2}n^3+\frac{1}{4}n^2$$ and $$B=\Sigma_{1}^{n}k=\frac{1}{2}n^2+\frac{1}{2}n$$ $A-B^2=0$. :)

-
If you are presenting this proof,write it nicely. $A=\frac{n^2(n+1)^2}{4}$ and $B=\frac{n(n+1)}{2}$,obviously $A=B^2$ –  Aang Jun 27 '12 at 10:40
@avatar: Dear Avatar; I will. Your proof is great and it looks analytically. Thanks. :-) –  B. S. Jun 27 '12 at 10:48
sorry, if you felt that i was being rude. –  Aang Jun 27 '12 at 10:53
@avatar: Your proof lights mine. No Problem at all. WELCOME Avatar. :) :) –  B. S. Jun 27 '12 at 10:57

The sum of a degree $n$ polynomial $f(n)$ will be a degree $n+1$ polynomial $S(n)$ for $n \geq 0$ and both polynomials can be extended (maintaining the relation $S(n)-S(n-1) = f(n)$) to negative $n$. To verify that the formula for $\Sigma k^3$ is correct one need only test it for any 5 distinct values of $n$, but the structure of the answer can be predicted algebraically using the continuation to negative $n$.

If $S(n) = (1^3 + 2^3 + \dots n^3)$ is the polynomial that satisfies $S(n)-S(n-1) = n^3$ and $S(1)=1$, then one can calculate from that equation that $S(0)=S(-1)=0$ and $S(-n-1)=S(n)$ for all negative $n$, so that $S$ is symmetric around $-1/2$. The vanishing at 0 and -1 implies that $S(t)$ is divisible as a polynomial by $t(t+1)$. The symmetry implies that $S(t)$ is a function (necessarily a polynomial) of $t(t+1)$.

$S(t)$ being of degree 4, this means $S(n) = a (n)(n+1) + b((n^2 +n)^2$ for constants $a$ and $b$. Summation being analogous to integration (and equal to it in a suitable limit), they have to agree on highest degree terms. Here it forces $b$ to be $1/4$ to match $\int x^3 = x^4/4$. Computing the sum at a single point such as $n=1$ determines $a$, which is zero.

Similar reasoning shows that $S_k(n)$ is divisible as a polynomial by $n(n+1)$ for all $k$. For odd $k$, $S_k(n)$ is a polynomial in $n(n+1)$.

-

You know, $\sum_0^n x^k=\frac{1-x^{n+1}}{1-x}$. Differentiate both sides once, $\sum_1^n kx^{k-1}=\frac{x^n(nx-n-1)+1}{x^2-2x+1}$. Now taking $\lim_{x\to1}$ both sides and then squaring the result will give you the expression on the RHS. You can further differentiate $\sum_0^n x^k=\frac{1-x^{n+1}}{1-x}$ until you get $k^3$ inside the expression, take limit again you will get the same result as of $(\lim_{x\to1}\frac{x^n(nx-n-1)+1}{x^2-2x+1})^2$. You can also prove it using telescopic series.

-
why does the assumption hold? this is usually proved using induction... –  akkkk Jun 27 '12 at 9:47
what assumption?? –  Aang Jun 27 '12 at 9:48
I guess Auke means $\sum_{0}^{n} x^k=\frac{1-x^{n+1}}{1-x}$. –  sdcvvc Jun 27 '12 at 10:12
LHS is a geometric series. en.wikipedia.org/wiki/Geometric_progression –  Aang Jun 27 '12 at 10:14
@Auke: one can also prove it like this - let $f(x) = \sum\limits_{k=0}^nx^k$, then $f(x) - xf(x)$ is: \begin{align} 1+&x+x^2+\dots+x^n \\ &- \\ &x+x^2+\dots+x^n+x^{n+1} \end{align} which is $1-x^{n+1}$. Hence $$(1-x)f(x) = 1-x^{n+1}$$ as needed. –  Ilya Jun 27 '12 at 12:40

http://en.wikipedia.org/wiki/Faulhaber%27s_formula#Faulhaber_polynomials

If $p$ is odd, then $1^p+2^p+3^p+\cdots+n^p$ is a polynomial function of $a=1+2+3+\cdots+n$. If $p=3$, then then the sum is $a^2$; if $p=5$ then it's $(4a^3-a^2)/3$, and so on.

-
And $a$ is always a factor of $p$. –  lhf Sep 3 '11 at 13:26

http://blogs.mathworks.com/loren/2010/03/04/nichomachuss-theorem/

-

$f(n)=1^3+2^3+3^3+......+n^3$

$f(n-1)=1^3+2^3+3^3+......+(n-1)^3$

$f(n)-f(n-1)=n^3$

if $f(n)= (1+2+3+4+....+n)^2$ then

$$f(n)-f(n-1)=(1+2+3+4+....+n)^2-(1+2+3+4+....+(n-1))^2$$

using $a^2-b^2=(a+b)(a-b)$

$f(n)-f(n-1)=$

$=[1+1+2+2+3+3+4+4+....+(n-1)+(n-1)+n][1-1+2-2+3-3+4-4+....+(n-1)-(n-1)+n]=$

$=[2(1+2+3+4+....+(n-1))+n]n=(2\frac{n(n-1)}{2}+n)n=(n(n-1)+n)n=n^3$

-
This is about the same proof as here, the presentation is a bit different though. This is another way to make $k^3$ appear than what was shown here, here and here.


### Author Topic: Q6 TUT 0202  (Read 2820 times)

#### Victor Ivrii

• Elder Member
• Posts: 2599
• Karma: 0
##### Q6 TUT 0202
« on: November 17, 2018, 04:09:19 PM »
Find the Laurent series for the given function $f(z)$ about the indicated point. Also, give the residue of the function at the point.
$$f(z)=\frac{1}{e^z-1};\qquad z_0=0\quad \text{(four terms of the Laurent series)} .$$

#### Meng Wu

• Elder Member
• Posts: 91
• Karma: 36
• MAT3342018F
##### Re: Q6 TUT 0202
« Reply #1 on: November 17, 2018, 04:09:29 PM »
$$\because e^z=\sum_{n=0}^{\infty}\frac{z^n}{n!}=1+z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots$$
\begin{align}\therefore e^z-1&=(1+z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots)-1\\&=z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots \end{align}
Added omitted calculation of order of pole: (thanks Chunjing Zhang for pointing it out)
$$g(z)=\frac{1}{f(z)}=\frac{1}{\frac{1}{e^z-1}}=e^z-1\\g(z_0=0)=e^0-1=0\\g'(z)=e^z \Rightarrow g(z_0=0)=e^0=1\neq 0 \\$$
Thus the order of the pole of $f(z)$ at $z_0=0$ is $1$.
Hence we let $$\frac{1}{e^z-1}=a_{-1}z^{-1}+a_0+a_1z+a_2z^2+a_3z^3+a_4z^4+\cdots$$
$$\therefore(e^z-1)(\frac{1}{e^z-1})=1\\\therefore (z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}+\frac{z^5}{120}+\cdots)(a_{-1}z^{-1}+a_0+a_1z+a_2z^2+a_3z^3+a_4z^4+\cdots)=1$$
$$\Rightarrow a_{-1}+a_0z+a_1z^2+a_2z^3+\frac{1}{2}z+\frac{a_0}{2}z^2+\frac{a_1}{2}z^3+\frac{a_{-1}}{6}z^2+\frac{a_0}{6}z^3+\frac{a_{-1}}{24}z^3+\cdots=1$$
$$\therefore \begin{cases}a_{-1}=1\\a_0z+\frac{a_{-1}}{2}z=0 \Rightarrow a_0+\frac{a_{-1}}{2}=0 \Rightarrow a_0=-\frac{1}{2}\\\frac{a_{-1}}{6}z^2+\frac{a_0}{2}z^2+a_1z^2=0 \Rightarrow \frac{a_{-1}}{6}+\frac{a_0}{2}+a_1=0 \Rightarrow a_1=\frac{1}{12}\\ \frac{a_{-1}}{24}z^3+\frac{a_0}{6}z^3+\frac{a_1}{2}z^3+a_2z^3 \Rightarrow \frac{a_{-1}}{24}+\frac{a_0}{6}+\frac{a_1}{2}+a_2=0 \Rightarrow a_2=0\end{cases}$$
Therefore, the first four terms of the Laurent series:
$$\require{cancel} \cancel{1+\frac{1}{z}+(-\frac{1}{2})z^2+(0)z^3} \\ \text{Typo correction: } \frac{1}{z}-\frac{1}{2}+\frac{1}{12}z+(0)z^2$$
$$\\$$
$$\\$$
The residue of given function at $z_0$ is the coefficient of $(z-z_0)^{-1}$, which is $1$.
$$\\$$
$$\\$$
If $0(z^3)=0$ is not counted since its zero, we could have $a_3z^4+\frac{a_2}{2}z^4+\frac{a_1}{6}z^4+\frac{a_0}{24}z^4+\frac{a_{-1}}{120}z^4 \Rightarrow a_3=-\frac{1}{720}$
$\\$
Hence we have $\frac{1}{z}-\frac{1}{2}+\frac{1}{12}z+(0)z^2-\frac{1}{720}z^3$.
« Last Edit: November 17, 2018, 11:00:48 PM by Meng Wu »

#### Heng Kan

• Full Member
• Posts: 15
• Karma: 18
##### Re: Q6 TUT 0202
« Reply #2 on: November 17, 2018, 05:30:38 PM »
I think you got the coefficients correctly but the Laurent series  is wrong.  Here is my answer. See the attatched scanned picture.

#### Chunjing Zhang

• Newbie
• Posts: 1
• Karma: 0
##### Re: Q6 TUT 0202
« Reply #3 on: November 17, 2018, 06:00:55 PM »
I think maybe it is needed to first calculate the singularity of the original function, here pole of order 1, and then set the expansion start at power of -1.

#### Victor Ivrii

We have two solutions based on two different ideas: undetermined coefficients and a clever  substitution of the power expansion into power expansion. Why clever? Because it chips out $1$ from $(e^z-1)/z$ rather than from $e^z-1$ (which would be an error)


# Proving recursive formula via induction leads to extra term?

I have been asked the following question, and despite spending the last 30 minutes on it, have not come up with a good result:

Define $$f(1) = 2$$, and $$f(n) = f(n-1) + 2n$$ for all $$n \geq 2$$. Find a non-recursive formula for $$n$$, and prove by induction this formula works over all natural numbers.

So, this didn't sound too hard. I found the non-recursive formula to be $$f(n) = n^2 + n$$.

Base case of induction with $$n = 2$$:

$$f(2) = 2^2 + 2 = 6$$

Assumption step:

$$f(k) = k^2 + k$$

Extension step:

\begin{aligned} f(k+1) & = (k+1)^2 + (k+1) \\ & = (k^2 + 2k + 1) + (k+1) \\ & = f(k) + 2k + 2 \ (?) && (\text{Substitute} \ f(k)) \end{aligned}

Notice it all falls apart here? That extra "$$2$$" terms means any experimental result I plug in yields a value $$2$$ higher than it should.

What have I done wrong?

• You're almost done. By the recursive formula, what does $f(k+1)$ equal? Edit: It doesn't fall apart at all. Aug 10 '15 at 10:52
• The recursive formula would be f(k+1) = f(k) + 2(k+1)... ohh I see. I'm an idiot. Why did I miss that? Aug 10 '15 at 10:56
• @EchoLogic, happens to all of us sometimes. Aug 13 '15 at 18:30
• Please add your own answer to this question, completing the details of the above comments, and later accept it to close this question. Sep 3 '15 at 17:01

We have, the recursion formula, \begin{aligned} f(1) = 2, f(n) = f(n-1) + 2n && (1)\end{aligned}

and, the candidate, \begin{aligned}P(n): f(n) = n^2 + n && (2)\end{aligned}

### Step-1: (Base Case)

By $$(1)$$, we have:

$$f(1) = 2$$, and $$f(2) = f(1) + 2 \cdot 2 = 6$$

These are satisfied by $$(2)$$ also, via direct calculation. Hence, the base case is established.

### Step-2: (Induction Hypothesis/ Extension step)

Assume that the statement holds for $$n=k$$,

i.e. $$P(k): f(k) = k^2 + k$$, holds.

### Step-3: (Inductive step)

We now, prove $$P(k+1)$$, which is the subject of the question,

By $$(1)$$,

\begin{aligned} f(k+1) & = f(k) + 2 \cot (k+1) && (\text{Taking,} \ \ n= (k+1)) \\ & = (k^2 + k) + (2k + 2) && (\text{By the Induction Hypothesis}) \\ & = (k^2 + 2k + 1) + (k+1) \\ \implies f(k+1) & = (k+1)^2 + (k+1) \end{aligned}

Thus, $$P(k+1)$$ is established, contingent upon $$P(k)$$ holding.

By the Principle of Mathematical Induction, the formula $$(2)$$ holds.

## Notes:

A. The working presented in the OP has two flaws:

1. The failure to recognize that the expression in the last step has the formula was the desired result, minus taking a common factor. This had been pointed out by @Git Gud and recognized by the OP, in the comments.

2. The more important issue is that the presented working confounds the statement that is given to be true, eq. $$(1)$$, and the one that is to be proved, eq. $$(2)$$. Specifically, the induction hypothesis assumes $$P(k)$$, so that the next step should be to establish $$P(k+1)$$. However, the OP assumes $$P(k+1)$$ in accordance with $$(2)$$, and tries to show how this implies $$(1)$$. Now, this works for the present case as all the operations involved are bidirectional $$(\iff)$$. Thus,we do indeed show that $$(1)$$ implies $$(2)$$, establishing $$P(k+1)$$. However, this is poor form that disrupts the flow of the logic and can lead to trouble if one is dealing with problems regarding say, inequalities. Although working backwards is a legitimate strategy that can be very useful, it requires care to ensure that the reversed steps are valid and useful, and is, at any rate not required here.

B. The notation $$P(k)$$, indicates the statement, $$P(n)$$, that is, ($$f(n) =n^2+n$$), for the case $$n=k$$. $$P(n)$$ is the statement that in the general case that there is an arbitrary $$n \in \mathbb{N}$$, we have $$f(n) = n^2 + n$$. This is a standard notation (albeit not one mentioned in OP's working in the question) in problems where mathematical induction is used, among others.

C. While mathematical induction can be useful for proving true statements over $$\mathbb{N}$$ (and many other cases, including well-founded sets in general), it is not nearly as useful in detecting the invalidity of false statements, and does not the address the important problem of generating plausible statements to check. Indeed, generating the formula is the first part of the problem the OP set out to solve. In the case, the formula was (almost certainly by design), trivial to guess. However, the generation of such statements. and particularly finding explicit formulae for recurrence relations; can be a very challenging problem to solve, and offers an interesting counterpoint to the problem of solving differential equations over $$\mathbb{R}$$ or $$\mathbb{C}$$. While a full discussion would be wildly out of scope here, it is interesting to note that here: $$\frac{f(n)-f(n-1)}{n-(n-1)} = 2n$$ which is reminiscent of the derivative over $$\mathbb{R}$$ and suggesting the appropriate solution should be a quadratic polynomial, as is indeed the case. It is left to the reader to verify that modifying the initial condition leads to solutions of the form $$n^2 + n + f(1) - 2$$.


# A nice way to factorize FRACTIONS!

I recently learned that ...

$\frac{1}{n(n+d)}$ = $\frac{1}{d}(\frac{1}{n}-\frac{1}{n+d})$

For example,

$\frac{1}{3*5}=\frac{1}{3(3+2)}=\frac{1}{2}(\frac{1}{3}-\frac{1}{5})$

Which is useful because we can use this equation in situation like this...

Find the value of $\frac{1}{3*5}+\frac{1}{5*7}+\frac{1}{7*9}+\frac{1}{9*11}$

$=\frac{1}{2}(\frac{1}{3}-\frac{1}{5})+\frac{1}{2}(\frac{1}{5}-\frac{1}{7})+\frac{1}{2}(\frac{1}{7}-\frac{1}{9})+\frac{1}{2}(\frac{1}{9}-\frac{1}{11})$

Take the common factor out

$\frac{1}{2}[(\frac{1}{3}-\frac{1}{5})+(\frac{1}{5}-\frac{1}{7})+(\frac{1}{7}-\frac{1}{9})+(\frac{1}{9}-\frac{1}{11})]$

The terms cancels each other and we are left with the first and last terms.

$\frac{1}{2}[\frac{1}{3}-\frac{1}{11}]$

which is $\frac{4}{33}$ This way is MUCH faster than the traditional way

Anyone can prove why the equation i learned is true?

Note by Peter Bishop
5 years, 3 months ago

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $ ... $ or $ ... $ to ensure proper formatting.
2 \times 3 $2 \times 3$
2^{34} $2^{34}$
a_{i-1} $a_{i-1}$
\frac{2}{3} $\frac{2}{3}$
\sqrt{2} $\sqrt{2}$
\sum_{i=1}^3 $\sum_{i=1}^3$
\sin \theta $\sin \theta$
\boxed{123} $\boxed{123}$

Sort by:

$\dfrac{1}{n(n+d)}$

$= \dfrac{1}{d} \times \dfrac{d}{n(n+d)}$

$= \dfrac{1}{d} \times \dfrac{(n+d) - (n)}{n(n+d)}$

$= \dfrac{1}{d} \times \left(\dfrac{n+d}{n(n+d)} - \dfrac{n}{n(n+d)} \right)$

$= \dfrac{1}{d} \times \left( \dfrac{1}{n} - \dfrac{1}{n+d} \right)$

- 5 years, 3 months ago

By using Partial Fractions,let - $\frac{1}{n(n+d)}$ = $\frac{A}{n} + \frac{B}{n+d}$
Thus, we need to find the coefficients A and B. Therefore,by taking LCM,we get -
$\frac{1}{n(n+d)}$ = $\frac{A(n+d) + B \cdot n}{n(n+d)}$. Or, $1= n(A + B) + A \cdot d$
Now, comparing the terms for different exponents of 'n' on both sides, we get-

{ This can be explained by example given below -

If ax + b = 3x +2 , then , a = 3 and b = 2 }

(Comparing the terms which contains $n^0$on both sides),

$n^0 : A \cdot d =1, or , A = \frac{1}{d}$

(Comparing the terms which contains $n^1$ on both sides),

$n^1 : A + B =0 , or, B = -A ,$

Or, $B = \frac{-1}{d}$

Therefore, $\frac{1}{n(n+d)}$ = $\frac{\frac{1}{d}}{n} + \frac{\frac{-1}{d}}{n+d}$

$\frac{1}{n(n+d)}$ = $\frac{1}{d} ( \frac{1}{n} - \frac{1}{n+d})$

- 5 years, 3 months ago

Awesome!!!!!!!!!!!!!!! Thank you very much.

- 5 years, 3 months ago

But i still don't understand the exponents of n part. Can you please explain futher.

- 5 years, 3 months ago

He is using a property called "comparing coefficients" (or at least that is what I call it)

It states the following: For any two polynomials $P(x)=a_nx^n+a_{n-1}x^{n-1}+\cdots +a_1x+a_0$ and $Q(x)=b_nx^n+b_{n-1}x^{n-1}+\cdots +b_1x+b_0$ such that $P(x)=Q(x)$, then $a_i=b_i$ for all $i=0\to n$.

- 5 years, 3 months ago

It's pretty easy.Multiply the RHS by $n(n+d)$ and you will get $\frac {1}{d}.[(n+d)-n]=1$ And that's it.

- 5 years, 3 months ago

wow...good formula for rememberd

- 5 years, 3 months ago

Woah, cool bro!

- 5 years, 3 months ago

Guys, if you like what you learnt, please reshare it so others can see. Thanks for the comments

- 5 years, 3 months ago

Awesome method! From where did you get this??

- 5 years, 3 months ago

From a tutor

- 5 years, 3 months ago

when we can write the pattern or series in the form that difference of two numbers and such that it get cancelled it makes the work easier this is called v n method or elemination method

- 5 years, 3 months ago

I just learnt A+B=0 so, A=-B wa0w. R I Newton yet?

- 5 years, 3 months ago

1/n(n+d) =1/d x d/n(n=d) =1/d x (n+d)-(n)/n(n+d) =1/d x {(n+d)/n(n+d-(n)/n(n+d)} =1/d x (1/n-1-n+d) HENCE PROVED

- 5 years, 3 months ago

This method is use to solve many problems and is called telescoping method I think.

- 2 years, 10 months ago


# Is it possible to put $+$ or $-$ signs in such a way that $\pm 1 \pm 2 \pm \cdots \pm 100 = 101$?

I'm reading a book about combinatorics. Even though the book is about combinatorics there is a problem in the book that I can think of no solutions to it except by using number theory.

Problem: Is it possible to put $+$ or $-$ signs in such a way that $\pm 1 \pm 2 \pm \cdots \pm 100 = 101$?

My proof is kinda simple. Let's work in mod $2$. We'll have:

$\pm 1 \pm 2 \pm \cdots \pm 100 \equiv 101 \mod 2$ but since $+1 \equiv -1 \mod 2$ and there are exactly $50$ odd numbers and $50$ even numbers from $1$ to $100$ we can write:

$(1 + 0 + \cdots + 1 + 0 \equiv 50\times 1 \equiv 0) \not\equiv (101\equiv 1) \mod 2$ which is contradictory.

Therefore, it's not possible to choose $+$ or $-$ signs in any way to make them equal.

Now is there a combinatorial proof of that fact except what I have in mind?

• A standard problem often classified as combinatorics is that the number of people who shook hands with an odd number of people is even. This one uses much the same idea. – André Nicolas Aug 28 '13 at 22:41
• @AndréNicolas: If you already have the proof in your mind, would you please post a proof of my problem using the handshaking lemma? – user66733 Aug 28 '13 at 22:49
• Frankly, I like your proof better than any of the answers. – asmeurer Aug 29 '13 at 4:48
• Another way of phrasing your own solution: We consider the sum of 100 numbers, 50 odd ones and 50 even ones. That will be an even sum. Negating a number (changing sign from $-$ to $+$ or from $+$ to $-$) does not change its parity (its being odd or even). – Jeppe Stig Nielsen Aug 29 '13 at 9:43
• @AndréNicolas: I haven't chosen the best answer yet because I'm still waiting for your answer based on the handshaking Lemma. If you have such a proof in mind please post it, because I'm really interested in it and it sounds like the most combinatorial solution to me. – user66733 Aug 31 '13 at 2:55

You can rephrase essentially the same argument in the following terms:

Suppose that there were such a pattern of plus and minus signs. Let $P$ be the set of positive terms, and let $N$ be the set of negative terms together with the number $101$. Then $\sum P-\sum N=0$, so $\sum P=\sum N$, and $\{P,N\}$ is a partition of $\{1,2,\ldots,101\}$ into two sets with equal sum. But $\sum_{k=1}^{101}k=\frac12\cdot101\cdot102=101\cdot51$ is odd, so this is impossible.

Another answer that use almost the same idea: the sum or subtraction of two even or odd number is an even number. How many odd number we have?

Replacing 100 with $n$ and using Brian M. Scott's solution, we want a partition of $\{1, 2, ..., n+1\}$ into two sets with equal sums.

The sum is $\frac{(n+1)(n+2)}{2}$, and if $n=4k$, this is $(4k+1)(2k+1)$ which is odd and therefore impossible.

If $n = 4k+1$, this is $(2k+1)(4k+3)$ which is also odd, and therefore impossible.

If $n = 4k+2$, this is $(4k+3)(2k+2)$, so it is not ruled out, and each sum must be $(4k+3)(k+1)$.

if $n = 4k+3$, this is $(2k+2)(4k+5)$ which is also not ruled out, and each sum must be $(k+1)(4k+5)$.

Now I'll try to find a solution for the not impossible cases. (I am working these out as I enter them.)

For the $n=4k+2$ case, the sum must be $(4k+3)(k+1) =(4k+4-1)(k+1) =4(k+1)^2-(k+1) =(2k+2)^2-(k+1)$. The square there suggests, to me, the formula for the sum of consecutive odd numbers $1+3+...+(2m-1)=m^2$, so $1+3+...+(4k+3) = (2k+2)^2$. If $k+1$ is odd, remove it from the sum so it is $(2k+2)^2-(k+1)$. If $k+1$ is even, both $1$ and $k$ are odd, so remove them from the sum. In either case, we have the desired partition.

For the $n=4k+3$ case, the sum must be $(4k+5)(k+1) =(4k+4+1)(k+1) =4(k+1)^2+(k+1) =(2k+2)^2+(k+1)$. Again, $1+3+...+(4k+3) = (2k+2)^2$. If $k+1$ is even, add it to the sum so it is $(2k+2)^2+(k+1)$. If $k+1$ is odd, $k+2$ is even, so remove $1$ and add $k+2$ to the sum. In either case, we have the desired partition.

I do not know if these partitions are unique.

If $T_n=n(n+1)/2$ is the $n^{th}$ triangular number, an inductive proof (using $T_n+(n+1)=T_{n+1}$) shows the attainable numbers at step $n$ are $$-T_n,\ -T_n+2,\ \cdots , T_n-2, \ T_n,$$ in particular they all have the same parity as $T_n$. Since $T_{100}=5050$ is even, we see that $101$ cannot be attained in any way by $100$ steps.

addendum: The first triangular number at least $101$ is $T_{14}=105$ (and is odd). This overshoots the goal $101$ by $4$, so if we take the sum $$1+2+3+\cdots+14=105$$ and change the sign on the $2$, we get $101$. Seems this is the only way to get $101$ in 14 steps, and we cannot get it with 13 or fewer since $T_{13}=91$ is the largest with $13$ steps.

Consider both sides modulo $2$. Then the right side is $1$, whereas the left side is $0$ (since it consists of $50$ ones and $50$ zeros).


# Why does probability of 50/50 outcome decrease as we toss a coin more and more?

I have following formula ("n" is number of experiments, "k" is number of successes that we expect, "p" is probability of success, "q" is probability of failure):

I used it to calculate chances of getting strictly 2 heads out of 4 tosses (order doesn't matter), 5 heads of 10 tosses, 10 heads out of 20 tosses.

2 heads out of 4 tosses have around 38% probability.

5 heads out of 10 tosses have around 25% probability.

10 heads out of 20 tosses have around 18% probability.

Looks like trend for me. And this trend is paradoxical, it means that by increasing number of tries we will decrease chance for 50/50 outcome. It seems to be at odds with what I was taught before. I was taught that as we increase number of tosses we will come closer and closer to 50/50 outcome. So if I toss a coin 10 times I can get 1 head and 9 tails, while tossing a coin 1000 times is more likely to give me result much closer to 50/50 outcome.

• What p and what q are you using? – Mariano Suárez-Álvarez Feb 13 '18 at 18:20
• This is because throwing exactly 50% is not likely to happen most of the time, you can sometimes land around the 11/20 mark, or 9/20. These are still very close to 10/20, and on average you are still getting an even distribution. As you increase $n$, there are more numbers close to the 50% mark for your eventual count to finish on, so this probability is spread out between these values. – John Doe Feb 13 '18 at 18:21
• Notice that that formula gives you the probability of getting exactly $k$ successes. As $n$ increases, it is harder and harder to have exactly $n/2$ tails. – Mariano Suárez-Álvarez Feb 13 '18 at 18:21
• It's true that the probability of getting exactly 50-50 goes down. But the average deviation of from $.5$ gets smaller and smaller. When $n=10$ it's relatively common to see $.6$ or $.4$ (corresponding to $6/10$ or $4/10$ heads.) For $n=10000000$ it is pretty much impossible for $60\%$ or more of the flips to come up heads. – spaceisdarkgreen Feb 13 '18 at 18:33
• Consider also that for an odd number of coin flips, the probability of exactly 50-50 is always zero – spaceisdarkgreen Feb 13 '18 at 18:36

This is because the more you flip a coin, the less likely it will be that you get heads $exactly$ half of the time. It is true, however, that the more you flip a coin, and then compute

$$\hat{p}=\frac{\text{number of heads}}{\text{number of tosses}}$$

that $\hat{p}$ will $converge$ to $0.5$. Consider flipping a coin $10$ times and obtaining $6$ heads. Then consider flipping a coin $1000$ times and obtaining $526$ heads.

While in the second instance, we are $26$ heads away from a perfect $50/50$, proportionally, we are closer as $0.526$ is closer to $0.5$ than $0.6$.

• Please, add information about spreading out probability to your answer because it's incomplete without it. " As you increase n, there are more numbers close to the 50% mark for your eventual count to finish on, so this probability is spread out between these values." – user161005 Feb 13 '18 at 18:41
• @user161005 are you talking about my comment on the question? This is not my answer.. – John Doe Feb 13 '18 at 18:42
• Sorry, confused you with other guy. Silly me. – user161005 Feb 13 '18 at 18:52

As it's been said, the fact that there are more and more possible values is what makes $\hat p=0.5$ less and less probable as exact value ($\hat p =\tfrac{\#heads}{\#toses}$).

Consider, for instance, the probability of $\tfrac 1 2 - \tfrac 1 {10}<\hat p_n<\tfrac 1 2 + \tfrac 1 {10}$, that is $$P\left(\tfrac 1 2 - \tfrac 1 {10}<\hat p_n<\tfrac 1 2 + \tfrac 1 {10}\right)=P\left(- \tfrac {2\sqrt n} {10}<\frac{\hat p_n-\tfrac 1 2}{\frac1{2\sqrt n}} < \tfrac {2\sqrt n} {10}\right)\approx 2\cdot\Phi\left(\tfrac {\sqrt n} {5}\right)-1$$ the approximation based on the CLT, valid for $n$ large enough.

Let's supose $n=50$. In that case we have $$P\left(\tfrac 1 2 - \tfrac 1 {10}<\hat p_{50}<\tfrac 1 2 + \tfrac 1 {10}\right)\approx 2\cdot \Phi\left(\frac{\sqrt {50}}5\right)-1\approx 0.8427.$$

Now let's do the same fot $n=100$. We get $$P\left(\tfrac 1 2 - \tfrac 1 {10}<\hat p_{100}<\tfrac 1 2 + \tfrac 1 {10}\right)\approx 2\cdot \Phi\left(\frac{\sqrt {100}}5\right)-1\approx 0.9545.$$ So the probability of $\hat p_n$ taking a value at a distance less than $0.1$ from the expected value has increased by around a 13%. But the values of $X=\#heads$ corresponding to that event went from $9$ (that is $21$ to $29$) to $19$ ($41$ to $59$), around the double. And if we kept doubling $n$ (for example), we would approximately double the number of integer values of $X$ that lead to $0.4<\hat p_n<0.6$ each time, but the total probability distributed between those values won't grow that much, fundamentally because it's very close to $1$, which is a bound, no matter $n$.

So, those probabilities which stay almost constant at some point, are distributed among more and more possible values of the measured discrete variable, and so is not surprising that the probability at each individual point decreases.