← Google Interview Insights

Google·Data Scientist·Technical Phone Screen·Senior

SeniorPrefer not to say
Jun 2026

Summary

Google data scientist interview that went deep into linear algebra and high-dimensional regression. The questions were genuinely hard and felt more like a stats PhD oral exam than a typical DS screen. Left feeling like I'd passed some parts and completely fumbled others.

Questions Asked (4)

Q1

Derive the OLS estimator from scratch and explain what rank conditions are needed for it to be identifiable. What is the sampling distribution of the estimator under classical assumptions?

Technical Trade-offsData ModelingAlgorithms & Data Structures
Author's notes

I can derive this in my sleep so the algebra was fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by setting up the linear model and deriving the OLS estimator via minimizing the sum of squared residuals, then discuss the rank condition for identifiability, and finally state the sampling distribution under classical assumptions. Emphasize the role of assumptions in ensuring unbiasedness and efficiency.

Pro tip: Connect the rank condition to multicollinearity and its practical implications, and mention that while OLS is unbiased under Gauss-Markov, normality of errors is needed for exact t and F tests in small samples.

1. Set up the linear model

Define the model y = Xβ + ε, with X an n×k matrix, and state the classical assumptions (linearity, exogeneity, homoskedasticity, no autocorrelation, and optionally normality).

2. Derive the OLS estimator

Minimize the sum of squared residuals (y - Xβ)'(y - Xβ) by taking the derivative with respect to β, setting it to zero, and solving the normal equations to get β_hat = (X'X)^{-1}X'y.

3. Discuss identifiability and rank condition

Explain that for (X'X) to be invertible, X must have full column rank k (no perfect multicollinearity). If not, the OLS estimator is not unique and parameters are not identifiable.

4. Derive the sampling distribution

Under classical assumptions, β_hat is unbiased with covariance matrix σ²(X'X)^{-1}. If errors are normally distributed, β_hat ~ N(β, σ²(X'X)^{-1}). For large samples, asymptotic normality holds under weaker conditions.

Key Points to Mention

  • OLS minimizes the sum of squared residuals, leading to the normal equations X'Xβ = X'y.
  • The rank condition: X must have full column rank (no perfect multicollinearity) for (X'X) to be invertible.
  • Under Gauss-Markov assumptions, OLS is BLUE (Best Linear Unbiased Estimator).
  • The sampling distribution of β_hat is normal if errors are normal; otherwise, it is asymptotically normal.
  • The covariance matrix of β_hat is σ²(X'X)^{-1}, and σ² is estimated by the residual sum of squares divided by n-k.
  • Practical implications: multicollinearity inflates standard errors, making coefficients unstable and hard to interpret.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

When you have more predictors than observations, what are your options? Walk through at least three regularization or dimensionality reduction approaches, and explain how you'd pick the regularization parameter and validate the model.

Technical Trade-offsData ModelingAlgorithms & Data Structures
Author's notes

This is where the interview got interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem as high-dimensional regression where p > n, then present three distinct approaches: L1 (Lasso), L2 (Ridge), and dimensionality reduction (PCA/PLS). For each, explain the mechanism, trade-offs, and how to tune the regularization parameter via cross-validation, emphasizing that validation must account for the small sample size.

Pro tip: Mention that with p >> n, standard k-fold CV can be unstable; use repeated k-fold or leave-one-out CV, and consider that Lasso may select at most n variables, so elastic net or ridge might be preferable when predictors are correlated.

1. Frame the problem and its challenges

Acknowledge that p > n leads to multicollinearity, overfitting, and non-unique solutions in ordinary least squares. State that regularization or dimensionality reduction is necessary.

2. Present three approaches with trade-offs

Describe Lasso (L1), Ridge (L2), and PCA/PLS. For each, explain how it handles p > n, its strengths (e.g., Lasso for sparsity, Ridge for correlated predictors, PCA for unsupervised reduction), and limitations.

3. Explain parameter tuning via cross-validation

Detail how to select the regularization parameter (lambda) using cross-validation, specifically k-fold or leave-one-out, and mention that the optimal lambda minimizes CV error. For PCA/PLS, discuss choosing the number of components via CV or scree plot.

4. Discuss model validation and pitfalls

Emphasize that validation must be done on held-out data or via nested CV to avoid optimistic bias. Mention that with small n, repeated CV or bootstrapping can provide more stable estimates.

5. Conclude with practical recommendations

Summarize when to use each method: Lasso for sparse true models, Ridge when many small effects, PCA/PLS for unsupervised or when interpretability of components is acceptable. Suggest starting with Ridge or Elastic Net as robust defaults.

Key Points to Mention

  • L1 regularization (Lasso) performs variable selection and yields sparse solutions, but can select at most n variables.
  • L2 regularization (Ridge) shrinks coefficients and handles multicollinearity well, but does not perform variable selection.
  • Dimensionality reduction via PCA or PLS reduces features to a smaller set of components, but may lose interpretability.
  • Cross-validation (k-fold, leave-one-out, repeated k-fold) is used to tune lambda or number of components, with the goal of minimizing prediction error.
  • Nested cross-validation is recommended for unbiased performance estimation when tuning hyperparameters.
  • Elastic Net combines L1 and L2 penalties and can be advantageous when predictors are correlated and p > n.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

When does the Moore-Penrose pseudoinverse give you a useful minimum-norm solution, and what are the practical drawbacks of relying on it?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

Blanked for a moment.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the Moore-Penrose pseudoinverse and its role in solving linear systems, emphasizing the minimum-norm least-squares solution. Then discuss scenarios where it is useful (e.g., underdetermined or overdetermined systems, rank-deficient matrices) and highlight practical drawbacks such as computational cost, numerical instability, and lack of regularization. Conclude with alternatives like ridge regression or iterative methods when appropriate.

Pro tip: Mention that while the pseudoinverse is theoretically elegant, in practice you often use SVD-based implementations and consider regularization (e.g., ridge) to handle ill-posed problems, especially in high-dimensional data.

1. Define the pseudoinverse and minimum-norm solution

Explain that the Moore-Penrose pseudoinverse provides the minimum-norm least-squares solution to Ax = b, even when A is singular or non-square.

2. Identify useful scenarios

Discuss cases like underdetermined systems (infinite solutions, pick smallest norm), overdetermined systems (least squares), and rank-deficient matrices where standard inverse fails.

3. Highlight practical drawbacks

Cover computational complexity (SVD is O(n^3)), numerical instability for ill-conditioned matrices, and lack of regularization leading to overfitting or meaningless solutions.

4. Compare with alternatives

Mention that in practice, regularized methods (ridge, LASSO) or iterative solvers (conjugate gradient) are often preferred for large-scale or noisy problems.

5. Conclude with when to use it

Summarize that the pseudoinverse is useful for small, well-conditioned problems or as a theoretical baseline, but for real-world data science tasks, consider regularization and scalability.

Key Points to Mention

  • Minimum-norm solution for underdetermined systems
  • Least-squares solution for overdetermined systems
  • Handling rank-deficient matrices via SVD
  • Computational cost: O(n^3) for SVD
  • Numerical instability with ill-conditioned matrices
  • Alternatives: ridge regression, iterative methods, regularization

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Why doesn't simply duplicating rows in your dataset fix a rank deficiency problem, and how does it affect your inference?

Data ModelingTechnical Trade-offs
Author's notes

My gut said 'obviously it doesn't add new information' and I said exactly that.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying that rank deficiency is a property of the column space of the design matrix, not the number of rows. Then explain that duplicating rows does not add new independent information, so the matrix remains rank deficient, and discuss the consequences for inference such as underestimated standard errors and invalid test statistics.

Pro tip: Mention that while duplicating rows doesn't fix rank deficiency, it can artificially inflate the apparent sample size and precision, leading to overconfident but biased inferences. A mature answer will also note that the correct fix is to address the root cause, such as removing collinear features or using regularization.

1. Define rank deficiency

Explain that rank deficiency occurs when the design matrix does not have full column rank, meaning some columns are linearly dependent. This is a structural issue, not a sample size issue.

2. Explain why duplication fails

Duplicating rows does not change the column space or the linear dependencies among columns. The rank of the matrix remains the same because the new rows are linear combinations of existing rows.

3. Discuss impact on inference

Duplicating rows artificially increases the sample size, leading to underestimated standard errors and inflated test statistics. This results in false confidence in parameter estimates and invalid hypothesis tests.

4. Provide correct solutions

Suggest addressing the root cause: remove or combine collinear features, use regularization (e.g., ridge regression), or apply dimensionality reduction techniques like PCA.

Key Points to Mention

  • Rank deficiency is about linear dependence among columns, not the number of rows.
  • Duplicating rows does not add new information; it only replicates existing data points.
  • The design matrix's rank remains unchanged after duplication.
  • Inference is affected because standard errors are computed based on the assumption of independent observations; duplication violates this and artificially reduces variance estimates.
  • Consequences include inflated Type I error rates and overfitting.
  • Correct approaches: remove collinear features, use regularization, or collect more diverse data.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.